| 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 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 | 2045 |
| 2045 bool use_threaded_event_handling = true; | 2046 bool use_threaded_event_handling = true; |
| 2046 #if defined(OS_MACOSX) | 2047 #if defined(OS_MACOSX) |
| 2047 // Disable threaded event handling if content is not handling the elastic | 2048 // Disable threaded event handling if content is not handling the elastic |
| 2048 // overscroll effect. This includes the cases where the elastic overscroll | 2049 // overscroll effect. This includes the cases where the elastic overscroll |
| 2049 // effect is being handled by Blink (because of command line flags) and older | 2050 // effect is being handled by Blink (because of command line flags) and older |
| 2050 // operating system versions which do not have an elastic overscroll effect | 2051 // operating system versions which do not have an elastic overscroll effect |
| 2051 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). | 2052 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). |
| 2052 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); | 2053 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); |
| 2053 #endif | 2054 #endif |
| 2054 if (use_threaded_event_handling) { | 2055 if (!use_threaded_event_handling) |
| 2055 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 2056 return; |
| 2056 // render_thread may be NULL in tests. | 2057 |
| 2057 InputHandlerManager* input_handler_manager = | 2058 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 2058 render_thread ? render_thread->input_handler_manager() : NULL; | 2059 // render_thread may be NULL in tests. |
| 2059 if (input_handler_manager) { | 2060 InputHandlerManager* input_handler_manager = |
| 2060 input_handler_manager->AddInputHandler( | 2061 render_thread ? render_thread->input_handler_manager() : NULL; |
| 2061 GetRoutingID(), rwc->GetInputHandler(), AsWeakPtr(), | 2062 if (input_handler_manager) { |
| 2062 webkit_preferences_.enable_scroll_animator, | 2063 input_handler_manager->AddInputHandler( |
| 2063 UseGestureBasedWheelScrolling()); | 2064 GetRoutingID(), rwc->GetInputHandler(), AsWeakPtr(), |
| 2064 } | 2065 webkit_preferences_.enable_scroll_animator, |
| 2066 UseGestureBasedWheelScrolling()); |
| 2067 has_added_input_handler_ = true; |
| 2065 } | 2068 } |
| 2066 } | 2069 } |
| 2067 | 2070 |
| 2068 bool RenderViewImpl::allowsBrokenNullLayerTreeView() const { | 2071 bool RenderViewImpl::allowsBrokenNullLayerTreeView() const { |
| 2069 return RenderWidget::allowsBrokenNullLayerTreeView(); | 2072 return RenderWidget::allowsBrokenNullLayerTreeView(); |
| 2070 } | 2073 } |
| 2071 | 2074 |
| 2072 void RenderViewImpl::closeWidgetSoon() { | 2075 void RenderViewImpl::closeWidgetSoon() { |
| 2073 RenderWidget::closeWidgetSoon(); | 2076 RenderWidget::closeWidgetSoon(); |
| 2074 } | 2077 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2207 const blink::WebElement& element) { | 2210 const blink::WebElement& element) { |
| 2208 blink::WebRect bounding_box_in_window = element.boundsInViewport(); | 2211 blink::WebRect bounding_box_in_window = element.boundsInViewport(); |
| 2209 ConvertViewportToWindowViaWidget(&bounding_box_in_window); | 2212 ConvertViewportToWindowViaWidget(&bounding_box_in_window); |
| 2210 return gfx::RectF(bounding_box_in_window); | 2213 return gfx::RectF(bounding_box_in_window); |
| 2211 } | 2214 } |
| 2212 | 2215 |
| 2213 float RenderViewImpl::GetDeviceScaleFactorForTest() const { | 2216 float RenderViewImpl::GetDeviceScaleFactorForTest() const { |
| 2214 return device_scale_factor_; | 2217 return device_scale_factor_; |
| 2215 } | 2218 } |
| 2216 | 2219 |
| 2220 bool RenderViewImpl::HasAddedInputHandler() const { |
| 2221 return has_added_input_handler_; |
| 2222 } |
| 2223 |
| 2217 gfx::Point RenderViewImpl::ConvertWindowPointToViewport( | 2224 gfx::Point RenderViewImpl::ConvertWindowPointToViewport( |
| 2218 const gfx::Point& point) { | 2225 const gfx::Point& point) { |
| 2219 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0); | 2226 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0); |
| 2220 convertWindowToViewport(&point_in_viewport); | 2227 convertWindowToViewport(&point_in_viewport); |
| 2221 return gfx::Point(point_in_viewport.x, point_in_viewport.y); | 2228 return gfx::Point(point_in_viewport.x, point_in_viewport.y); |
| 2222 } | 2229 } |
| 2223 | 2230 |
| 2224 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2231 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
| 2225 WebIconURL::Type icon_type) { | 2232 WebIconURL::Type icon_type) { |
| 2226 if (frame->parent()) | 2233 if (frame->parent()) |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3402 return render_frame->focused_pepper_plugin(); | 3409 return render_frame->focused_pepper_plugin(); |
| 3403 } | 3410 } |
| 3404 frame = frame->traverseNext(false); | 3411 frame = frame->traverseNext(false); |
| 3405 } | 3412 } |
| 3406 | 3413 |
| 3407 return nullptr; | 3414 return nullptr; |
| 3408 } | 3415 } |
| 3409 #endif | 3416 #endif |
| 3410 | 3417 |
| 3411 } // namespace content | 3418 } // namespace content |
| OLD | NEW |