| 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_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 580 |
| 581 bool handled = true; | 581 bool handled = true; |
| 582 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) | 582 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) |
| 583 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) | 583 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) |
| 584 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, | 584 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, |
| 585 OnCursorVisibilityChange) | 585 OnCursorVisibilityChange) |
| 586 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) | 586 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) |
| 587 IPC_MESSAGE_HANDLER(InputMsg_ImeCommitText, OnImeCommitText) | 587 IPC_MESSAGE_HANDLER(InputMsg_ImeCommitText, OnImeCommitText) |
| 588 IPC_MESSAGE_HANDLER(InputMsg_ImeFinishComposingText, | 588 IPC_MESSAGE_HANDLER(InputMsg_ImeFinishComposingText, |
| 589 OnImeFinishComposingText) | 589 OnImeFinishComposingText) |
| 590 IPC_MESSAGE_HANDLER(InputMsg_ImeApplySuggestionReplacement, |
| 591 OnImeApplySuggestionReplacement) |
| 592 IPC_MESSAGE_HANDLER(InputMsg_ImeDeleteSuggestionHighlight, |
| 593 OnImeDeleteSuggestionHighlight) |
| 594 IPC_MESSAGE_HANDLER(InputMsg_ImeCloseSuggestionMenu, |
| 595 OnImeCloseSuggestionMenu) |
| 590 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) | 596 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) |
| 591 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 597 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 592 OnSetEditCommandsForNextKeyEvent) | 598 OnSetEditCommandsForNextKeyEvent) |
| 593 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) | 599 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) |
| 594 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, | 600 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, |
| 595 OnSyntheticGestureCompleted) | 601 OnSyntheticGestureCompleted) |
| 596 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 602 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
| 597 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 603 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
| 598 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, | 604 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, |
| 599 OnEnableDeviceEmulation) | 605 OnEnableDeviceEmulation) |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); | 1074 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); |
| 1069 | 1075 |
| 1070 text_input_info_ = new_info; | 1076 text_input_info_ = new_info; |
| 1071 text_input_type_ = new_type; | 1077 text_input_type_ = new_type; |
| 1072 text_input_mode_ = new_mode; | 1078 text_input_mode_ = new_mode; |
| 1073 can_compose_inline_ = new_can_compose_inline; | 1079 can_compose_inline_ = new_can_compose_inline; |
| 1074 text_input_flags_ = new_info.flags; | 1080 text_input_flags_ = new_info.flags; |
| 1075 } | 1081 } |
| 1076 } | 1082 } |
| 1077 | 1083 |
| 1084 void RenderWidget::HandlePotentialTextSuggestionTap() { |
| 1085 blink::WebInputMethodController* controller = GetInputMethodController(); |
| 1086 if (!controller) |
| 1087 return; |
| 1088 |
| 1089 WebVector<blink::WebTextSuggestionInfo> suggestion_infos = |
| 1090 controller->getTextSuggestionInfosUnderCaret(); |
| 1091 |
| 1092 if (suggestion_infos.size() == 0) |
| 1093 return; |
| 1094 |
| 1095 // The composition is now on the suggestion range highlight |
| 1096 UpdateCompositionInfo(false /* not an immediate request */); |
| 1097 |
| 1098 Send(new InputHostMsg_ShowTextSuggestionMenu( |
| 1099 routing_id(), std::vector<blink::WebTextSuggestionInfo>( |
| 1100 suggestion_infos.begin(), suggestion_infos.end()))); |
| 1101 } |
| 1102 |
| 1078 bool RenderWidget::WillHandleGestureEvent(const blink::WebGestureEvent& event) { | 1103 bool RenderWidget::WillHandleGestureEvent(const blink::WebGestureEvent& event) { |
| 1079 possible_drag_event_info_.event_source = | 1104 possible_drag_event_info_.event_source = |
| 1080 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; | 1105 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; |
| 1081 possible_drag_event_info_.event_location = | 1106 possible_drag_event_info_.event_location = |
| 1082 gfx::Point(event.globalX, event.globalY); | 1107 gfx::Point(event.globalX, event.globalY); |
| 1083 | 1108 |
| 1084 return false; | 1109 return false; |
| 1085 } | 1110 } |
| 1086 | 1111 |
| 1087 bool RenderWidget::WillHandleMouseEvent(const blink::WebMouseEvent& event) { | 1112 bool RenderWidget::WillHandleMouseEvent(const blink::WebMouseEvent& event) { |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 input_handler_->set_handling_input_event(true); | 1631 input_handler_->set_handling_input_event(true); |
| 1607 if (auto* controller = GetInputMethodController()) { | 1632 if (auto* controller = GetInputMethodController()) { |
| 1608 controller->finishComposingText( | 1633 controller->finishComposingText( |
| 1609 keep_selection ? WebInputMethodController::KeepSelection | 1634 keep_selection ? WebInputMethodController::KeepSelection |
| 1610 : WebInputMethodController::DoNotKeepSelection); | 1635 : WebInputMethodController::DoNotKeepSelection); |
| 1611 } | 1636 } |
| 1612 input_handler_->set_handling_input_event(false); | 1637 input_handler_->set_handling_input_event(false); |
| 1613 UpdateCompositionInfo(false /* not an immediate request */); | 1638 UpdateCompositionInfo(false /* not an immediate request */); |
| 1614 } | 1639 } |
| 1615 | 1640 |
| 1641 void RenderWidget::OnImeApplySuggestionReplacement(int document_marker_id, |
| 1642 int suggestion_index) { |
| 1643 if (auto* controller = GetInputMethodController()) { |
| 1644 controller->applySuggestionReplacement(document_marker_id, |
| 1645 suggestion_index); |
| 1646 } |
| 1647 } |
| 1648 |
| 1649 void RenderWidget::OnImeDeleteSuggestionHighlight() { |
| 1650 if (auto* controller = GetInputMethodController()) { |
| 1651 controller->deleteSuggestionHighlight(); |
| 1652 } |
| 1653 } |
| 1654 |
| 1655 void RenderWidget::OnImeCloseSuggestionMenu() { |
| 1656 if (auto* controller = GetInputMethodController()) |
| 1657 controller->closeSuggestionMenu(); |
| 1658 } |
| 1659 |
| 1616 void RenderWidget::OnDeviceScaleFactorChanged() { | 1660 void RenderWidget::OnDeviceScaleFactorChanged() { |
| 1617 if (!compositor_) | 1661 if (!compositor_) |
| 1618 return; | 1662 return; |
| 1619 if (IsUseZoomForDSFEnabled()) | 1663 if (IsUseZoomForDSFEnabled()) |
| 1620 compositor_->SetPaintedDeviceScaleFactor(GetOriginalDeviceScaleFactor()); | 1664 compositor_->SetPaintedDeviceScaleFactor(GetOriginalDeviceScaleFactor()); |
| 1621 else | 1665 else |
| 1622 compositor_->setDeviceScaleFactor(device_scale_factor_); | 1666 compositor_->setDeviceScaleFactor(device_scale_factor_); |
| 1623 } | 1667 } |
| 1624 | 1668 |
| 1625 void RenderWidget::OnRepaint(gfx::Size size_to_paint) { | 1669 void RenderWidget::OnRepaint(gfx::Size size_to_paint) { |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2274 // browser side (https://crbug.com/669219). | 2318 // browser side (https://crbug.com/669219). |
| 2275 // If there is no WebFrameWidget, then there will be no | 2319 // If there is no WebFrameWidget, then there will be no |
| 2276 // InputMethodControllers for a WebLocalFrame. | 2320 // InputMethodControllers for a WebLocalFrame. |
| 2277 return nullptr; | 2321 return nullptr; |
| 2278 } | 2322 } |
| 2279 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2323 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
| 2280 ->getActiveWebInputMethodController(); | 2324 ->getActiveWebInputMethodController(); |
| 2281 } | 2325 } |
| 2282 | 2326 |
| 2283 } // namespace content | 2327 } // namespace content |
| OLD | NEW |