| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 has_scrolled_focused_editable_node_into_rect_(false), | 659 has_scrolled_focused_editable_node_into_rect_(false), |
| 660 page_zoom_level_(params.page_zoom_level), | 660 page_zoom_level_(params.page_zoom_level), |
| 661 main_render_frame_(nullptr), | 661 main_render_frame_(nullptr), |
| 662 frame_widget_(nullptr), | 662 frame_widget_(nullptr), |
| 663 speech_recognition_dispatcher_(NULL), | 663 speech_recognition_dispatcher_(NULL), |
| 664 mouse_lock_dispatcher_(NULL), | 664 mouse_lock_dispatcher_(NULL), |
| 665 #if defined(OS_ANDROID) | 665 #if defined(OS_ANDROID) |
| 666 expected_content_intent_id_(0), | 666 expected_content_intent_id_(0), |
| 667 #endif | 667 #endif |
| 668 enumeration_completion_id_(0), | 668 enumeration_completion_id_(0), |
| 669 session_storage_namespace_id_(params.session_storage_namespace_id) { | 669 session_storage_namespace_id_(params.session_storage_namespace_id), |
| 670 has_added_input_handler_(false) { |
| 670 GetWidget()->set_owner_delegate(this); | 671 GetWidget()->set_owner_delegate(this); |
| 671 } | 672 } |
| 672 | 673 |
| 673 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, | 674 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, |
| 674 bool was_created_by_renderer) { | 675 bool was_created_by_renderer) { |
| 675 SetRoutingID(params.view_id); | 676 SetRoutingID(params.view_id); |
| 676 | 677 |
| 677 int opener_view_routing_id; | 678 int opener_view_routing_id; |
| 678 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( | 679 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( |
| 679 params.opener_frame_route_id, &opener_view_routing_id); | 680 params.opener_frame_route_id, &opener_view_routing_id); |
| (...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2048 | 2049 |
| 2049 bool use_threaded_event_handling = true; | 2050 bool use_threaded_event_handling = true; |
| 2050 #if defined(OS_MACOSX) | 2051 #if defined(OS_MACOSX) |
| 2051 // Disable threaded event handling if content is not handling the elastic | 2052 // Disable threaded event handling if content is not handling the elastic |
| 2052 // overscroll effect. This includes the cases where the elastic overscroll | 2053 // overscroll effect. This includes the cases where the elastic overscroll |
| 2053 // effect is being handled by Blink (because of command line flags) and older | 2054 // effect is being handled by Blink (because of command line flags) and older |
| 2054 // operating system versions which do not have an elastic overscroll effect | 2055 // operating system versions which do not have an elastic overscroll effect |
| 2055 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). | 2056 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). |
| 2056 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); | 2057 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); |
| 2057 #endif | 2058 #endif |
| 2058 if (use_threaded_event_handling) { | 2059 if (!use_threaded_event_handling) |
| 2059 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 2060 return; |
| 2060 // render_thread may be NULL in tests. | 2061 |
| 2061 InputHandlerManager* input_handler_manager = | 2062 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 2062 render_thread ? render_thread->input_handler_manager() : NULL; | 2063 // render_thread may be NULL in tests. |
| 2063 if (input_handler_manager) { | 2064 InputHandlerManager* input_handler_manager = |
| 2064 input_handler_manager->AddInputHandler( | 2065 render_thread ? render_thread->input_handler_manager() : NULL; |
| 2065 GetRoutingID(), rwc->GetInputHandler(), AsWeakPtr(), | 2066 if (input_handler_manager) { |
| 2066 webkit_preferences_.enable_scroll_animator, | 2067 input_handler_manager->AddInputHandler( |
| 2067 UseGestureBasedWheelScrolling()); | 2068 GetRoutingID(), rwc->GetInputHandler(), AsWeakPtr(), |
| 2068 } | 2069 webkit_preferences_.enable_scroll_animator, |
| 2070 UseGestureBasedWheelScrolling()); |
| 2071 has_added_input_handler_ = true; |
| 2069 } | 2072 } |
| 2070 } | 2073 } |
| 2071 | 2074 |
| 2072 bool RenderViewImpl::allowsBrokenNullLayerTreeView() const { | 2075 bool RenderViewImpl::allowsBrokenNullLayerTreeView() const { |
| 2073 return RenderWidget::allowsBrokenNullLayerTreeView(); | 2076 return RenderWidget::allowsBrokenNullLayerTreeView(); |
| 2074 } | 2077 } |
| 2075 | 2078 |
| 2076 void RenderViewImpl::closeWidgetSoon() { | 2079 void RenderViewImpl::closeWidgetSoon() { |
| 2077 RenderWidget::closeWidgetSoon(); | 2080 RenderWidget::closeWidgetSoon(); |
| 2078 } | 2081 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 const blink::WebElement& element) { | 2214 const blink::WebElement& element) { |
| 2212 blink::WebRect bounding_box_in_window = element.boundsInViewport(); | 2215 blink::WebRect bounding_box_in_window = element.boundsInViewport(); |
| 2213 ConvertViewportToWindowViaWidget(&bounding_box_in_window); | 2216 ConvertViewportToWindowViaWidget(&bounding_box_in_window); |
| 2214 return gfx::RectF(bounding_box_in_window); | 2217 return gfx::RectF(bounding_box_in_window); |
| 2215 } | 2218 } |
| 2216 | 2219 |
| 2217 float RenderViewImpl::GetDeviceScaleFactorForTest() const { | 2220 float RenderViewImpl::GetDeviceScaleFactorForTest() const { |
| 2218 return device_scale_factor_; | 2221 return device_scale_factor_; |
| 2219 } | 2222 } |
| 2220 | 2223 |
| 2224 bool RenderViewImpl::HasAddedInputHandler() const { |
| 2225 return has_added_input_handler_; |
| 2226 } |
| 2227 |
| 2221 gfx::Point RenderViewImpl::ConvertWindowPointToViewport( | 2228 gfx::Point RenderViewImpl::ConvertWindowPointToViewport( |
| 2222 const gfx::Point& point) { | 2229 const gfx::Point& point) { |
| 2223 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0); | 2230 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0); |
| 2224 convertWindowToViewport(&point_in_viewport); | 2231 convertWindowToViewport(&point_in_viewport); |
| 2225 return gfx::Point(point_in_viewport.x, point_in_viewport.y); | 2232 return gfx::Point(point_in_viewport.x, point_in_viewport.y); |
| 2226 } | 2233 } |
| 2227 | 2234 |
| 2228 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2235 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
| 2229 WebIconURL::Type icon_type) { | 2236 WebIconURL::Type icon_type) { |
| 2230 if (frame->parent()) | 2237 if (frame->parent()) |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3393 return render_frame->focused_pepper_plugin(); | 3400 return render_frame->focused_pepper_plugin(); |
| 3394 } | 3401 } |
| 3395 frame = frame->traverseNext(false); | 3402 frame = frame->traverseNext(false); |
| 3396 } | 3403 } |
| 3397 | 3404 |
| 3398 return nullptr; | 3405 return nullptr; |
| 3399 } | 3406 } |
| 3400 #endif | 3407 #endif |
| 3401 | 3408 |
| 3402 } // namespace content | 3409 } // namespace content |
| OLD | NEW |