| 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 | 656 |
| 657 return RenderThread::Get()->Send(message); | 657 return RenderThread::Get()->Send(message); |
| 658 } | 658 } |
| 659 | 659 |
| 660 void RenderWidget::SendOrCrash(IPC::Message* message) { | 660 void RenderWidget::SendOrCrash(IPC::Message* message) { |
| 661 bool result = Send(message); | 661 bool result = Send(message); |
| 662 CHECK(closing_ || result) << "Failed to send message"; | 662 CHECK(closing_ || result) << "Failed to send message"; |
| 663 } | 663 } |
| 664 | 664 |
| 665 bool RenderWidget::ShouldHandleImeEvents() const { | 665 bool RenderWidget::ShouldHandleImeEvents() const { |
| 666 return GetWebWidget()->isWebFrameWidget() && has_focus_; | 666 // TODO(ekaramad): We track page focus in all RenderViews on the page but the |
| 667 // RenderWidgets corresponding to OOPIFs do not get the update. For now, this |
| 668 // method returns true when the RenderWidget is for an OOPIF, i.e., IME events |
| 669 // will be processed regardless of page focus. We should revisit this after |
| 670 // page focus for OOPIFs has been fully resolved (https://crbug.com/689777). |
| 671 return GetWebWidget() && GetWebWidget()->isWebFrameWidget() && |
| 672 (has_focus_ || for_oopif_); |
| 667 } | 673 } |
| 668 | 674 |
| 669 void RenderWidget::SetWindowRectSynchronously( | 675 void RenderWidget::SetWindowRectSynchronously( |
| 670 const gfx::Rect& new_window_rect) { | 676 const gfx::Rect& new_window_rect) { |
| 671 ResizeParams params; | 677 ResizeParams params; |
| 672 params.screen_info = screen_info_; | 678 params.screen_info = screen_info_; |
| 673 params.new_size = new_window_rect.size(); | 679 params.new_size = new_window_rect.size(); |
| 674 params.physical_backing_size = | 680 params.physical_backing_size = |
| 675 gfx::ScaleToCeiledSize(new_window_rect.size(), device_scale_factor_); | 681 gfx::ScaleToCeiledSize(new_window_rect.size(), device_scale_factor_); |
| 676 params.visible_viewport_size = new_window_rect.size(); | 682 params.visible_viewport_size = new_window_rect.size(); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 #endif | 1569 #endif |
| 1564 if (replacement_range.IsValid()) { | 1570 if (replacement_range.IsValid()) { |
| 1565 GetWebWidget()->applyReplacementRange( | 1571 GetWebWidget()->applyReplacementRange( |
| 1566 WebRange(replacement_range.start(), replacement_range.length())); | 1572 WebRange(replacement_range.start(), replacement_range.length())); |
| 1567 } | 1573 } |
| 1568 | 1574 |
| 1569 if (!GetWebWidget()) | 1575 if (!GetWebWidget()) |
| 1570 return; | 1576 return; |
| 1571 ImeEventGuard guard(this); | 1577 ImeEventGuard guard(this); |
| 1572 input_handler_->set_handling_input_event(true); | 1578 input_handler_->set_handling_input_event(true); |
| 1573 if (auto* controller = GetInputMethodController()) | 1579 if (auto* controller = GetInputMethodController()) { |
| 1574 controller->commitText(text, WebVector<WebCompositionUnderline>(underlines), | 1580 controller->commitText(text, WebVector<WebCompositionUnderline>(underlines), |
| 1575 relative_cursor_pos); | 1581 relative_cursor_pos); |
| 1582 } |
| 1576 input_handler_->set_handling_input_event(false); | 1583 input_handler_->set_handling_input_event(false); |
| 1577 UpdateCompositionInfo(false /* not an immediate request */); | 1584 UpdateCompositionInfo(false /* not an immediate request */); |
| 1578 } | 1585 } |
| 1579 | 1586 |
| 1580 void RenderWidget::OnImeFinishComposingText(bool keep_selection) { | 1587 void RenderWidget::OnImeFinishComposingText(bool keep_selection) { |
| 1581 if (!ShouldHandleImeEvents()) | 1588 if (!ShouldHandleImeEvents()) |
| 1582 return; | 1589 return; |
| 1583 | 1590 |
| 1584 #if BUILDFLAG(ENABLE_PLUGINS) | 1591 #if BUILDFLAG(ENABLE_PLUGINS) |
| 1585 if (focused_pepper_plugin_) { | 1592 if (focused_pepper_plugin_) { |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2264 // browser side (https://crbug.com/669219). | 2271 // browser side (https://crbug.com/669219). |
| 2265 // If there is no WebFrameWidget, then there will be no | 2272 // If there is no WebFrameWidget, then there will be no |
| 2266 // InputMethodControllers for a WebLocalFrame. | 2273 // InputMethodControllers for a WebLocalFrame. |
| 2267 return nullptr; | 2274 return nullptr; |
| 2268 } | 2275 } |
| 2269 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2276 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
| 2270 ->getActiveWebInputMethodController(); | 2277 ->getActiveWebInputMethodController(); |
| 2271 } | 2278 } |
| 2272 | 2279 |
| 2273 } // namespace content | 2280 } // namespace content |
| OLD | NEW |