| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 #include "third_party/WebKit/public/platform/WebSize.h" | 123 #include "third_party/WebKit/public/platform/WebSize.h" |
| 124 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" | 124 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" |
| 125 #include "third_party/WebKit/public/platform/WebString.h" | 125 #include "third_party/WebKit/public/platform/WebString.h" |
| 126 #include "third_party/WebKit/public/platform/WebURL.h" | 126 #include "third_party/WebKit/public/platform/WebURL.h" |
| 127 #include "third_party/WebKit/public/platform/WebURLError.h" | 127 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 128 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 128 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 129 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 129 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 130 #include "third_party/WebKit/public/platform/WebVector.h" | 130 #include "third_party/WebKit/public/platform/WebVector.h" |
| 131 #include "third_party/WebKit/public/public_features.h" | 131 #include "third_party/WebKit/public/public_features.h" |
| 132 #include "third_party/WebKit/public/web/WebAXObject.h" | 132 #include "third_party/WebKit/public/web/WebAXObject.h" |
| 133 #include "third_party/WebKit/public/web/WebAutofillClient.h" |
| 133 #include "third_party/WebKit/public/web/WebColorSuggestion.h" | 134 #include "third_party/WebKit/public/web/WebColorSuggestion.h" |
| 134 #include "third_party/WebKit/public/web/WebDOMEvent.h" | 135 #include "third_party/WebKit/public/web/WebDOMEvent.h" |
| 135 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" | 136 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" |
| 136 #include "third_party/WebKit/public/web/WebDataSource.h" | 137 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 137 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" | 138 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" |
| 138 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" | 139 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" |
| 139 #include "third_party/WebKit/public/web/WebDocument.h" | 140 #include "third_party/WebKit/public/web/WebDocument.h" |
| 140 #include "third_party/WebKit/public/web/WebElement.h" | 141 #include "third_party/WebKit/public/web/WebElement.h" |
| 141 #include "third_party/WebKit/public/web/WebFileChooserParams.h" | 142 #include "third_party/WebKit/public/web/WebFileChooserParams.h" |
| 142 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 143 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 #endif // ENABLE_PLUGINS | 1163 #endif // ENABLE_PLUGINS |
| 1163 | 1164 |
| 1164 void RenderViewImpl::TransferActiveWheelFlingAnimation( | 1165 void RenderViewImpl::TransferActiveWheelFlingAnimation( |
| 1165 const blink::WebActiveWheelFlingParameters& params) { | 1166 const blink::WebActiveWheelFlingParameters& params) { |
| 1166 if (webview()) | 1167 if (webview()) |
| 1167 webview()->TransferActiveWheelFlingAnimation(params); | 1168 webview()->TransferActiveWheelFlingAnimation(params); |
| 1168 } | 1169 } |
| 1169 | 1170 |
| 1170 // RenderWidgetInputHandlerDelegate ----------------------------------------- | 1171 // RenderWidgetInputHandlerDelegate ----------------------------------------- |
| 1171 | 1172 |
| 1172 void RenderViewImpl::RenderWidgetFocusChangeComplete() { | |
| 1173 for (auto& observer : observers_) | |
| 1174 observer.FocusChangeComplete(); | |
| 1175 } | |
| 1176 | |
| 1177 bool RenderViewImpl::DoesRenderWidgetHaveTouchEventHandlersAt( | 1173 bool RenderViewImpl::DoesRenderWidgetHaveTouchEventHandlersAt( |
| 1178 const gfx::Point& point) const { | 1174 const gfx::Point& point) const { |
| 1179 if (!webview()) | 1175 if (!webview()) |
| 1180 return false; | 1176 return false; |
| 1181 return webview()->HasTouchEventHandlersAt(point); | 1177 return webview()->HasTouchEventHandlersAt(point); |
| 1182 } | 1178 } |
| 1183 | 1179 |
| 1184 bool RenderViewImpl::RenderWidgetWillHandleMouseEvent( | 1180 bool RenderViewImpl::RenderWidgetWillHandleMouseEvent( |
| 1185 const blink::WebMouseEvent& event) { | 1181 const blink::WebMouseEvent& event) { |
| 1186 // If the mouse is locked, only the current owner of the mouse lock can | 1182 // If the mouse is locked, only the current owner of the mouse lock can |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 if (!webview()) | 1301 if (!webview()) |
| 1306 return; | 1302 return; |
| 1307 | 1303 |
| 1308 Send(new InputHostMsg_MoveCaret_ACK(GetRoutingID())); | 1304 Send(new InputHostMsg_MoveCaret_ACK(GetRoutingID())); |
| 1309 webview()->FocusedFrame()->MoveCaretSelection( | 1305 webview()->FocusedFrame()->MoveCaretSelection( |
| 1310 ConvertWindowPointToViewport(point)); | 1306 ConvertWindowPointToViewport(point)); |
| 1311 } | 1307 } |
| 1312 | 1308 |
| 1313 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect( | 1309 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect( |
| 1314 const gfx::Rect& rect) { | 1310 const gfx::Rect& rect) { |
| 1311 blink::WebAutofillClient* autofill_client = nullptr; |
| 1312 if (auto* focused_frame = GetWebView()->FocusedFrame()) |
| 1313 autofill_client = focused_frame->AutofillClient(); |
| 1314 |
| 1315 if (has_scrolled_focused_editable_node_into_rect_ && | 1315 if (has_scrolled_focused_editable_node_into_rect_ && |
| 1316 rect == rect_for_scrolled_focused_editable_node_) { | 1316 rect == rect_for_scrolled_focused_editable_node_ && autofill_client) { |
| 1317 GetWidget()->FocusChangeComplete(); | 1317 autofill_client->DidCompleteFocusChangeInFrame(); |
| 1318 return; | 1318 return; |
| 1319 } | 1319 } |
| 1320 | 1320 |
| 1321 if (!webview()->ScrollFocusedEditableElementIntoRect(rect)) | 1321 if (!webview()->ScrollFocusedEditableElementIntoRect(rect)) |
| 1322 return; | 1322 return; |
| 1323 | 1323 |
| 1324 rect_for_scrolled_focused_editable_node_ = rect; | 1324 rect_for_scrolled_focused_editable_node_ = rect; |
| 1325 has_scrolled_focused_editable_node_into_rect_ = true; | 1325 has_scrolled_focused_editable_node_into_rect_ = true; |
| 1326 if (!compositor()->HasPendingPageScaleAnimation()) | 1326 if (!compositor()->HasPendingPageScaleAnimation() && autofill_client) |
| 1327 GetWidget()->FocusChangeComplete(); | 1327 autofill_client->DidCompleteFocusChangeInFrame(); |
| 1328 } | 1328 } |
| 1329 | 1329 |
| 1330 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset, | 1330 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset, |
| 1331 int history_length) { | 1331 int history_length) { |
| 1332 DCHECK_GE(history_offset, -1); | 1332 DCHECK_GE(history_offset, -1); |
| 1333 DCHECK_GE(history_length, 0); | 1333 DCHECK_GE(history_length, 0); |
| 1334 | 1334 |
| 1335 history_list_offset_ = history_offset; | 1335 history_list_offset_ = history_offset; |
| 1336 history_list_length_ = history_length; | 1336 history_list_length_ = history_length; |
| 1337 } | 1337 } |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1796 void RenderViewImpl::Show(WebNavigationPolicy policy) { | 1796 void RenderViewImpl::Show(WebNavigationPolicy policy) { |
| 1797 if (did_show_ && !webkit_preferences_.supports_multiple_windows) { | 1797 if (did_show_ && !webkit_preferences_.supports_multiple_windows) { |
| 1798 // When supports_multiple_windows is disabled, popups are reusing | 1798 // When supports_multiple_windows is disabled, popups are reusing |
| 1799 // the same view. In some scenarios, this makes WebKit to call show() twice. | 1799 // the same view. In some scenarios, this makes WebKit to call show() twice. |
| 1800 return; | 1800 return; |
| 1801 } | 1801 } |
| 1802 | 1802 |
| 1803 RenderWidget::Show(policy); | 1803 RenderWidget::Show(policy); |
| 1804 } | 1804 } |
| 1805 | 1805 |
| 1806 void RenderViewImpl::OnMouseDown(const WebNode& mouse_down_node) { | |
| 1807 for (auto& observer : observers_) | |
| 1808 observer.OnMouseDown(mouse_down_node); | |
| 1809 } | |
| 1810 | 1806 |
| 1811 bool RenderViewImpl::CanHandleGestureEvent() { | 1807 bool RenderViewImpl::CanHandleGestureEvent() { |
| 1812 return true; | 1808 return true; |
| 1813 } | 1809 } |
| 1814 | 1810 |
| 1815 bool RenderViewImpl::CanUpdateLayout() { | 1811 bool RenderViewImpl::CanUpdateLayout() { |
| 1816 return true; | 1812 return true; |
| 1817 } | 1813 } |
| 1818 | 1814 |
| 1819 void RenderViewImpl::DidHandleGestureEvent(const WebGestureEvent& event, | 1815 void RenderViewImpl::DidHandleGestureEvent(const WebGestureEvent& event, |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2320 | 2316 |
| 2321 void RenderViewImpl::SetFocus(bool enable) { | 2317 void RenderViewImpl::SetFocus(bool enable) { |
| 2322 RenderWidget::OnSetFocus(enable); | 2318 RenderWidget::OnSetFocus(enable); |
| 2323 | 2319 |
| 2324 // Notify all BrowserPlugins of the RenderView's focus state. | 2320 // Notify all BrowserPlugins of the RenderView's focus state. |
| 2325 if (BrowserPluginManager::Get()) | 2321 if (BrowserPluginManager::Get()) |
| 2326 BrowserPluginManager::Get()->UpdateFocusState(); | 2322 BrowserPluginManager::Get()->UpdateFocusState(); |
| 2327 } | 2323 } |
| 2328 | 2324 |
| 2329 void RenderViewImpl::DidCompletePageScaleAnimation() { | 2325 void RenderViewImpl::DidCompletePageScaleAnimation() { |
| 2330 GetWidget()->FocusChangeComplete(); | 2326 if (auto* focused_frame = GetWebView()->FocusedFrame()) { |
| 2327 if (focused_frame->AutofillClient()) |
| 2328 focused_frame->AutofillClient()->DidCompleteFocusChangeInFrame(); |
| 2329 } |
| 2331 } | 2330 } |
| 2332 | 2331 |
| 2333 void RenderViewImpl::OnDeviceScaleFactorChanged() { | 2332 void RenderViewImpl::OnDeviceScaleFactorChanged() { |
| 2334 RenderWidget::OnDeviceScaleFactorChanged(); | 2333 RenderWidget::OnDeviceScaleFactorChanged(); |
| 2335 UpdateWebViewWithDeviceScaleFactor(); | 2334 UpdateWebViewWithDeviceScaleFactor(); |
| 2336 if (auto_resize_mode_) | 2335 if (auto_resize_mode_) |
| 2337 AutoResizeCompositor(); | 2336 AutoResizeCompositor(); |
| 2338 } | 2337 } |
| 2339 | 2338 |
| 2340 void RenderViewImpl::SetScreenMetricsEmulationParameters( | 2339 void RenderViewImpl::SetScreenMetricsEmulationParameters( |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2674 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2673 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2675 } | 2674 } |
| 2676 | 2675 |
| 2677 std::unique_ptr<InputEventAck> ack(new InputEventAck( | 2676 std::unique_ptr<InputEventAck> ack(new InputEventAck( |
| 2678 InputEventAckSource::MAIN_THREAD, input_event->GetType(), | 2677 InputEventAckSource::MAIN_THREAD, input_event->GetType(), |
| 2679 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2678 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 2680 OnInputEventAck(std::move(ack)); | 2679 OnInputEventAck(std::move(ack)); |
| 2681 } | 2680 } |
| 2682 | 2681 |
| 2683 } // namespace content | 2682 } // namespace content |
| OLD | NEW |