| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 has_scrolled_focused_editable_node_into_rect_(false), | 652 has_scrolled_focused_editable_node_into_rect_(false), |
| 653 page_zoom_level_(params.page_zoom_level), | 653 page_zoom_level_(params.page_zoom_level), |
| 654 main_render_frame_(nullptr), | 654 main_render_frame_(nullptr), |
| 655 frame_widget_(nullptr), | 655 frame_widget_(nullptr), |
| 656 speech_recognition_dispatcher_(NULL), | 656 speech_recognition_dispatcher_(NULL), |
| 657 mouse_lock_dispatcher_(NULL), | 657 mouse_lock_dispatcher_(NULL), |
| 658 #if defined(OS_ANDROID) | 658 #if defined(OS_ANDROID) |
| 659 expected_content_intent_id_(0), | 659 expected_content_intent_id_(0), |
| 660 #endif | 660 #endif |
| 661 enumeration_completion_id_(0), | 661 enumeration_completion_id_(0), |
| 662 session_storage_namespace_id_(params.session_storage_namespace_id) { | 662 session_storage_namespace_id_(params.session_storage_namespace_id), |
| 663 has_added_input_handler_(false) { |
| 663 GetWidget()->set_owner_delegate(this); | 664 GetWidget()->set_owner_delegate(this); |
| 664 } | 665 } |
| 665 | 666 |
| 666 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, | 667 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, |
| 667 bool was_created_by_renderer) { | 668 bool was_created_by_renderer) { |
| 668 SetRoutingID(params.view_id); | 669 SetRoutingID(params.view_id); |
| 669 | 670 |
| 670 int opener_view_routing_id; | 671 int opener_view_routing_id; |
| 671 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( | 672 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( |
| 672 params.opener_frame_route_id, &opener_view_routing_id); | 673 params.opener_frame_route_id, &opener_view_routing_id); |
| (...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 | 2040 |
| 2040 bool use_threaded_event_handling = true; | 2041 bool use_threaded_event_handling = true; |
| 2041 #if defined(OS_MACOSX) | 2042 #if defined(OS_MACOSX) |
| 2042 // Disable threaded event handling if content is not handling the elastic | 2043 // Disable threaded event handling if content is not handling the elastic |
| 2043 // overscroll effect. This includes the cases where the elastic overscroll | 2044 // overscroll effect. This includes the cases where the elastic overscroll |
| 2044 // effect is being handled by Blink (because of command line flags) and older | 2045 // effect is being handled by Blink (because of command line flags) and older |
| 2045 // operating system versions which do not have an elastic overscroll effect | 2046 // operating system versions which do not have an elastic overscroll effect |
| 2046 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). | 2047 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). |
| 2047 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); | 2048 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); |
| 2048 #endif | 2049 #endif |
| 2049 if (use_threaded_event_handling) { | 2050 if (!use_threaded_event_handling) |
| 2050 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 2051 return; |
| 2051 // render_thread may be NULL in tests. | 2052 |
| 2052 InputHandlerManager* input_handler_manager = | 2053 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 2053 render_thread ? render_thread->input_handler_manager() : NULL; | 2054 // render_thread may be NULL in tests. |
| 2054 if (input_handler_manager) { | 2055 InputHandlerManager* input_handler_manager = |
| 2055 input_handler_manager->AddInputHandler( | 2056 render_thread ? render_thread->input_handler_manager() : NULL; |
| 2056 GetRoutingID(), rwc->GetInputHandler(), AsWeakPtr(), | 2057 if (input_handler_manager) { |
| 2057 webkit_preferences_.enable_scroll_animator, | 2058 input_handler_manager->AddInputHandler( |
| 2058 UseGestureBasedWheelScrolling()); | 2059 GetRoutingID(), rwc->GetInputHandler(), AsWeakPtr(), |
| 2059 } | 2060 webkit_preferences_.enable_scroll_animator, |
| 2061 UseGestureBasedWheelScrolling()); |
| 2062 has_added_input_handler_ = true; |
| 2060 } | 2063 } |
| 2061 } | 2064 } |
| 2062 | 2065 |
| 2063 bool RenderViewImpl::allowsBrokenNullLayerTreeView() const { | 2066 bool RenderViewImpl::allowsBrokenNullLayerTreeView() const { |
| 2064 return RenderWidget::allowsBrokenNullLayerTreeView(); | 2067 return RenderWidget::allowsBrokenNullLayerTreeView(); |
| 2065 } | 2068 } |
| 2066 | 2069 |
| 2067 void RenderViewImpl::closeWidgetSoon() { | 2070 void RenderViewImpl::closeWidgetSoon() { |
| 2068 RenderWidget::closeWidgetSoon(); | 2071 RenderWidget::closeWidgetSoon(); |
| 2069 } | 2072 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2202 const blink::WebElement& element) { | 2205 const blink::WebElement& element) { |
| 2203 blink::WebRect bounding_box_in_window = element.boundsInViewport(); | 2206 blink::WebRect bounding_box_in_window = element.boundsInViewport(); |
| 2204 ConvertViewportToWindowViaWidget(&bounding_box_in_window); | 2207 ConvertViewportToWindowViaWidget(&bounding_box_in_window); |
| 2205 return gfx::RectF(bounding_box_in_window); | 2208 return gfx::RectF(bounding_box_in_window); |
| 2206 } | 2209 } |
| 2207 | 2210 |
| 2208 float RenderViewImpl::GetDeviceScaleFactorForTest() const { | 2211 float RenderViewImpl::GetDeviceScaleFactorForTest() const { |
| 2209 return device_scale_factor_; | 2212 return device_scale_factor_; |
| 2210 } | 2213 } |
| 2211 | 2214 |
| 2215 bool RenderViewImpl::HasAddedInputHandler() const { |
| 2216 return has_added_input_handler_; |
| 2217 } |
| 2218 |
| 2212 gfx::Point RenderViewImpl::ConvertWindowPointToViewport( | 2219 gfx::Point RenderViewImpl::ConvertWindowPointToViewport( |
| 2213 const gfx::Point& point) { | 2220 const gfx::Point& point) { |
| 2214 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0); | 2221 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0); |
| 2215 convertWindowToViewport(&point_in_viewport); | 2222 convertWindowToViewport(&point_in_viewport); |
| 2216 return gfx::Point(point_in_viewport.x, point_in_viewport.y); | 2223 return gfx::Point(point_in_viewport.x, point_in_viewport.y); |
| 2217 } | 2224 } |
| 2218 | 2225 |
| 2219 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2226 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
| 2220 WebIconURL::Type icon_type) { | 2227 WebIconURL::Type icon_type) { |
| 2221 if (frame->parent()) | 2228 if (frame->parent()) |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3369 return render_frame->focused_pepper_plugin(); | 3376 return render_frame->focused_pepper_plugin(); |
| 3370 } | 3377 } |
| 3371 frame = frame->traverseNext(false); | 3378 frame = frame->traverseNext(false); |
| 3372 } | 3379 } |
| 3373 | 3380 |
| 3374 return nullptr; | 3381 return nullptr; |
| 3375 } | 3382 } |
| 3376 #endif | 3383 #endif |
| 3377 | 3384 |
| 3378 } // namespace content | 3385 } // namespace content |
| OLD | NEW |