| 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 webview_(nullptr), | 622 webview_(nullptr), |
| 623 has_scrolled_focused_editable_node_into_rect_(false), | 623 has_scrolled_focused_editable_node_into_rect_(false), |
| 624 page_zoom_level_(params.page_zoom_level), | 624 page_zoom_level_(params.page_zoom_level), |
| 625 main_render_frame_(nullptr), | 625 main_render_frame_(nullptr), |
| 626 frame_widget_(nullptr), | 626 frame_widget_(nullptr), |
| 627 speech_recognition_dispatcher_(NULL), | 627 speech_recognition_dispatcher_(NULL), |
| 628 #if defined(OS_ANDROID) | 628 #if defined(OS_ANDROID) |
| 629 expected_content_intent_id_(0), | 629 expected_content_intent_id_(0), |
| 630 #endif | 630 #endif |
| 631 enumeration_completion_id_(0), | 631 enumeration_completion_id_(0), |
| 632 session_storage_namespace_id_(params.session_storage_namespace_id) { | 632 session_storage_namespace_id_(params.session_storage_namespace_id), |
| 633 has_added_input_handler_(false) { |
| 633 GetWidget()->set_owner_delegate(this); | 634 GetWidget()->set_owner_delegate(this); |
| 634 } | 635 } |
| 635 | 636 |
| 636 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, | 637 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, |
| 637 bool was_created_by_renderer) { | 638 bool was_created_by_renderer) { |
| 638 SetRoutingID(params.view_id); | 639 SetRoutingID(params.view_id); |
| 639 | 640 |
| 640 int opener_view_routing_id; | 641 int opener_view_routing_id; |
| 641 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( | 642 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( |
| 642 params.opener_frame_route_id, &opener_view_routing_id); | 643 params.opener_frame_route_id, &opener_view_routing_id); |
| (...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1945 | 1946 |
| 1946 bool use_threaded_event_handling = true; | 1947 bool use_threaded_event_handling = true; |
| 1947 #if defined(OS_MACOSX) | 1948 #if defined(OS_MACOSX) |
| 1948 // Disable threaded event handling if content is not handling the elastic | 1949 // Disable threaded event handling if content is not handling the elastic |
| 1949 // overscroll effect. This includes the cases where the elastic overscroll | 1950 // overscroll effect. This includes the cases where the elastic overscroll |
| 1950 // effect is being handled by Blink (because of command line flags) and older | 1951 // effect is being handled by Blink (because of command line flags) and older |
| 1951 // operating system versions which do not have an elastic overscroll effect | 1952 // operating system versions which do not have an elastic overscroll effect |
| 1952 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). | 1953 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). |
| 1953 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); | 1954 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); |
| 1954 #endif | 1955 #endif |
| 1955 if (use_threaded_event_handling) { | 1956 if (!use_threaded_event_handling) |
| 1956 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 1957 return; |
| 1957 // render_thread may be NULL in tests. | 1958 |
| 1958 InputHandlerManager* input_handler_manager = | 1959 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 1959 render_thread ? render_thread->input_handler_manager() : NULL; | 1960 // render_thread may be NULL in tests. |
| 1960 if (input_handler_manager) { | 1961 InputHandlerManager* input_handler_manager = |
| 1961 input_handler_manager->AddInputHandler( | 1962 render_thread ? render_thread->input_handler_manager() : NULL; |
| 1962 GetRoutingID(), rwc->GetInputHandler(), AsWeakPtr(), | 1963 if (input_handler_manager) { |
| 1963 webkit_preferences_.enable_scroll_animator); | 1964 input_handler_manager->AddInputHandler( |
| 1964 } | 1965 GetRoutingID(), rwc->GetInputHandler(), AsWeakPtr(), |
| 1966 webkit_preferences_.enable_scroll_animator); |
| 1967 has_added_input_handler_ = true; |
| 1965 } | 1968 } |
| 1966 } | 1969 } |
| 1967 | 1970 |
| 1968 bool RenderViewImpl::allowsBrokenNullLayerTreeView() const { | 1971 bool RenderViewImpl::allowsBrokenNullLayerTreeView() const { |
| 1969 return RenderWidget::allowsBrokenNullLayerTreeView(); | 1972 return RenderWidget::allowsBrokenNullLayerTreeView(); |
| 1970 } | 1973 } |
| 1971 | 1974 |
| 1972 void RenderViewImpl::closeWidgetSoon() { | 1975 void RenderViewImpl::closeWidgetSoon() { |
| 1973 RenderWidget::closeWidgetSoon(); | 1976 RenderWidget::closeWidgetSoon(); |
| 1974 } | 1977 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 const blink::WebElement& element) { | 2110 const blink::WebElement& element) { |
| 2108 blink::WebRect bounding_box_in_window = element.boundsInViewport(); | 2111 blink::WebRect bounding_box_in_window = element.boundsInViewport(); |
| 2109 ConvertViewportToWindowViaWidget(&bounding_box_in_window); | 2112 ConvertViewportToWindowViaWidget(&bounding_box_in_window); |
| 2110 return gfx::RectF(bounding_box_in_window); | 2113 return gfx::RectF(bounding_box_in_window); |
| 2111 } | 2114 } |
| 2112 | 2115 |
| 2113 float RenderViewImpl::GetDeviceScaleFactorForTest() const { | 2116 float RenderViewImpl::GetDeviceScaleFactorForTest() const { |
| 2114 return device_scale_factor_; | 2117 return device_scale_factor_; |
| 2115 } | 2118 } |
| 2116 | 2119 |
| 2120 bool RenderViewImpl::HasAddedInputHandler() const { |
| 2121 return has_added_input_handler_; |
| 2122 } |
| 2123 |
| 2117 gfx::Point RenderViewImpl::ConvertWindowPointToViewport( | 2124 gfx::Point RenderViewImpl::ConvertWindowPointToViewport( |
| 2118 const gfx::Point& point) { | 2125 const gfx::Point& point) { |
| 2119 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0); | 2126 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0); |
| 2120 convertWindowToViewport(&point_in_viewport); | 2127 convertWindowToViewport(&point_in_viewport); |
| 2121 return gfx::Point(point_in_viewport.x, point_in_viewport.y); | 2128 return gfx::Point(point_in_viewport.x, point_in_viewport.y); |
| 2122 } | 2129 } |
| 2123 | 2130 |
| 2124 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2131 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
| 2125 WebIconURL::Type icon_type) { | 2132 WebIconURL::Type icon_type) { |
| 2126 if (frame->parent()) | 2133 if (frame->parent()) |
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3229 return render_frame->focused_pepper_plugin(); | 3236 return render_frame->focused_pepper_plugin(); |
| 3230 } | 3237 } |
| 3231 frame = frame->traverseNext(false); | 3238 frame = frame->traverseNext(false); |
| 3232 } | 3239 } |
| 3233 | 3240 |
| 3234 return nullptr; | 3241 return nullptr; |
| 3235 } | 3242 } |
| 3236 #endif | 3243 #endif |
| 3237 | 3244 |
| 3238 } // namespace content | 3245 } // namespace content |
| OLD | NEW |