| 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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 | 663 |
| 664 return RenderThread::Get()->Send(message); | 664 return RenderThread::Get()->Send(message); |
| 665 } | 665 } |
| 666 | 666 |
| 667 void RenderWidget::SendOrCrash(IPC::Message* message) { | 667 void RenderWidget::SendOrCrash(IPC::Message* message) { |
| 668 bool result = Send(message); | 668 bool result = Send(message); |
| 669 CHECK(closing_ || result) << "Failed to send message"; | 669 CHECK(closing_ || result) << "Failed to send message"; |
| 670 } | 670 } |
| 671 | 671 |
| 672 bool RenderWidget::ShouldHandleImeEvents() const { | 672 bool RenderWidget::ShouldHandleImeEvents() const { |
| 673 return GetWebWidget()->isWebFrameWidget() && has_focus_; | 673 // TODO(ekaramad): We track page focus in all RenderViews on the page but the |
| 674 // RenderWidgets corresponding to OOPIFs do not get the update. For now, this |
| 675 // method returns true when the RenderWidget is for an OOPIF, i.e., IME events |
| 676 // will be processed regardless of page focus. We should revisit this after |
| 677 // page focus for OOPIFs has been fully resolved (https://crbug.com/689777). |
| 678 return GetWebWidget()->isWebFrameWidget() && (has_focus_ || for_oopif_); |
| 674 } | 679 } |
| 675 | 680 |
| 676 void RenderWidget::SetWindowRectSynchronously( | 681 void RenderWidget::SetWindowRectSynchronously( |
| 677 const gfx::Rect& new_window_rect) { | 682 const gfx::Rect& new_window_rect) { |
| 678 ResizeParams params; | 683 ResizeParams params; |
| 679 params.screen_info = screen_info_; | 684 params.screen_info = screen_info_; |
| 680 params.new_size = new_window_rect.size(); | 685 params.new_size = new_window_rect.size(); |
| 681 params.physical_backing_size = | 686 params.physical_backing_size = |
| 682 gfx::ScaleToCeiledSize(new_window_rect.size(), device_scale_factor_); | 687 gfx::ScaleToCeiledSize(new_window_rect.size(), device_scale_factor_); |
| 683 params.visible_viewport_size = new_window_rect.size(); | 688 params.visible_viewport_size = new_window_rect.size(); |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 #endif | 1614 #endif |
| 1610 if (replacement_range.IsValid()) { | 1615 if (replacement_range.IsValid()) { |
| 1611 GetWebWidget()->applyReplacementRange( | 1616 GetWebWidget()->applyReplacementRange( |
| 1612 WebRange(replacement_range.start(), replacement_range.length())); | 1617 WebRange(replacement_range.start(), replacement_range.length())); |
| 1613 } | 1618 } |
| 1614 | 1619 |
| 1615 if (!GetWebWidget()) | 1620 if (!GetWebWidget()) |
| 1616 return; | 1621 return; |
| 1617 ImeEventGuard guard(this); | 1622 ImeEventGuard guard(this); |
| 1618 input_handler_->set_handling_input_event(true); | 1623 input_handler_->set_handling_input_event(true); |
| 1619 if (auto* controller = GetInputMethodController()) | 1624 if (auto* controller = GetInputMethodController()) { |
| 1620 controller->commitText(WebString::fromUTF16(text), | 1625 controller->commitText(WebString::fromUTF16(text), |
| 1621 WebVector<WebCompositionUnderline>(underlines), | 1626 WebVector<WebCompositionUnderline>(underlines), |
| 1622 relative_cursor_pos); | 1627 relative_cursor_pos); |
| 1628 } |
| 1623 input_handler_->set_handling_input_event(false); | 1629 input_handler_->set_handling_input_event(false); |
| 1624 UpdateCompositionInfo(false /* not an immediate request */); | 1630 UpdateCompositionInfo(false /* not an immediate request */); |
| 1625 } | 1631 } |
| 1626 | 1632 |
| 1627 void RenderWidget::OnImeFinishComposingText(bool keep_selection) { | 1633 void RenderWidget::OnImeFinishComposingText(bool keep_selection) { |
| 1628 if (!ShouldHandleImeEvents()) | 1634 if (!ShouldHandleImeEvents()) |
| 1629 return; | 1635 return; |
| 1630 | 1636 |
| 1631 #if BUILDFLAG(ENABLE_PLUGINS) | 1637 #if BUILDFLAG(ENABLE_PLUGINS) |
| 1632 if (focused_pepper_plugin_) { | 1638 if (focused_pepper_plugin_) { |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2309 // browser side (https://crbug.com/669219). | 2315 // browser side (https://crbug.com/669219). |
| 2310 // If there is no WebFrameWidget, then there will be no | 2316 // If there is no WebFrameWidget, then there will be no |
| 2311 // InputMethodControllers for a WebLocalFrame. | 2317 // InputMethodControllers for a WebLocalFrame. |
| 2312 return nullptr; | 2318 return nullptr; |
| 2313 } | 2319 } |
| 2314 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2320 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
| 2315 ->getActiveWebInputMethodController(); | 2321 ->getActiveWebInputMethodController(); |
| 2316 } | 2322 } |
| 2317 | 2323 |
| 2318 } // namespace content | 2324 } // namespace content |
| OLD | NEW |