| 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 | 661 |
| 662 return RenderThread::Get()->Send(message); | 662 return RenderThread::Get()->Send(message); |
| 663 } | 663 } |
| 664 | 664 |
| 665 void RenderWidget::SendOrCrash(IPC::Message* message) { | 665 void RenderWidget::SendOrCrash(IPC::Message* message) { |
| 666 bool result = Send(message); | 666 bool result = Send(message); |
| 667 CHECK(closing_ || result) << "Failed to send message"; | 667 CHECK(closing_ || result) << "Failed to send message"; |
| 668 } | 668 } |
| 669 | 669 |
| 670 bool RenderWidget::ShouldHandleImeEvents() const { | 670 bool RenderWidget::ShouldHandleImeEvents() const { |
| 671 return GetWebWidget()->isWebFrameWidget() && has_focus_; | 671 // TODO(ekaramad): We track page focus in all RenderViews on the page but the |
| 672 // RenderWidgets corresponding to OOPIFs do not get the update. For now, this |
| 673 // method returns true when the RenderWidget is for an OOPIF, i.e., IME events |
| 674 // will be processed regardless of page focus. We should revisit this after |
| 675 // page focus for OOPIFs has been fully resolved (https://crbug.com/689777). |
| 676 return GetWebWidget()->isWebFrameWidget() && (has_focus_ || for_oopif_); |
| 672 } | 677 } |
| 673 | 678 |
| 674 void RenderWidget::SetWindowRectSynchronously( | 679 void RenderWidget::SetWindowRectSynchronously( |
| 675 const gfx::Rect& new_window_rect) { | 680 const gfx::Rect& new_window_rect) { |
| 676 ResizeParams params; | 681 ResizeParams params; |
| 677 params.screen_info = screen_info_; | 682 params.screen_info = screen_info_; |
| 678 params.new_size = new_window_rect.size(); | 683 params.new_size = new_window_rect.size(); |
| 679 params.physical_backing_size = | 684 params.physical_backing_size = |
| 680 gfx::ScaleToCeiledSize(new_window_rect.size(), device_scale_factor_); | 685 gfx::ScaleToCeiledSize(new_window_rect.size(), device_scale_factor_); |
| 681 params.visible_viewport_size = new_window_rect.size(); | 686 params.visible_viewport_size = new_window_rect.size(); |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 #endif | 1599 #endif |
| 1595 if (replacement_range.IsValid()) { | 1600 if (replacement_range.IsValid()) { |
| 1596 GetWebWidget()->applyReplacementRange( | 1601 GetWebWidget()->applyReplacementRange( |
| 1597 WebRange(replacement_range.start(), replacement_range.length())); | 1602 WebRange(replacement_range.start(), replacement_range.length())); |
| 1598 } | 1603 } |
| 1599 | 1604 |
| 1600 if (!GetWebWidget()) | 1605 if (!GetWebWidget()) |
| 1601 return; | 1606 return; |
| 1602 ImeEventGuard guard(this); | 1607 ImeEventGuard guard(this); |
| 1603 input_handler_->set_handling_input_event(true); | 1608 input_handler_->set_handling_input_event(true); |
| 1604 if (auto* controller = GetInputMethodController()) | 1609 if (auto* controller = GetInputMethodController()) { |
| 1605 controller->commitText(WebString::fromUTF16(text), | 1610 controller->commitText(WebString::fromUTF16(text), |
| 1606 WebVector<WebCompositionUnderline>(underlines), | 1611 WebVector<WebCompositionUnderline>(underlines), |
| 1607 relative_cursor_pos); | 1612 relative_cursor_pos); |
| 1613 } |
| 1608 input_handler_->set_handling_input_event(false); | 1614 input_handler_->set_handling_input_event(false); |
| 1609 UpdateCompositionInfo(false /* not an immediate request */); | 1615 UpdateCompositionInfo(false /* not an immediate request */); |
| 1610 } | 1616 } |
| 1611 | 1617 |
| 1612 void RenderWidget::OnImeFinishComposingText(bool keep_selection) { | 1618 void RenderWidget::OnImeFinishComposingText(bool keep_selection) { |
| 1613 if (!ShouldHandleImeEvents()) | 1619 if (!ShouldHandleImeEvents()) |
| 1614 return; | 1620 return; |
| 1615 | 1621 |
| 1616 #if BUILDFLAG(ENABLE_PLUGINS) | 1622 #if BUILDFLAG(ENABLE_PLUGINS) |
| 1617 if (focused_pepper_plugin_) { | 1623 if (focused_pepper_plugin_) { |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2293 // browser side (https://crbug.com/669219). | 2299 // browser side (https://crbug.com/669219). |
| 2294 // If there is no WebFrameWidget, then there will be no | 2300 // If there is no WebFrameWidget, then there will be no |
| 2295 // InputMethodControllers for a WebLocalFrame. | 2301 // InputMethodControllers for a WebLocalFrame. |
| 2296 return nullptr; | 2302 return nullptr; |
| 2297 } | 2303 } |
| 2298 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2304 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
| 2299 ->getActiveWebInputMethodController(); | 2305 ->getActiveWebInputMethodController(); |
| 2300 } | 2306 } |
| 2301 | 2307 |
| 2302 } // namespace content | 2308 } // namespace content |
| OLD | NEW |