Chromium Code Reviews| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 | 652 |
| 653 return RenderThread::Get()->Send(message); | 653 return RenderThread::Get()->Send(message); |
| 654 } | 654 } |
| 655 | 655 |
| 656 void RenderWidget::SendOrCrash(IPC::Message* message) { | 656 void RenderWidget::SendOrCrash(IPC::Message* message) { |
| 657 bool result = Send(message); | 657 bool result = Send(message); |
| 658 CHECK(closing_ || result) << "Failed to send message"; | 658 CHECK(closing_ || result) << "Failed to send message"; |
| 659 } | 659 } |
| 660 | 660 |
| 661 bool RenderWidget::ShouldHandleImeEvents() const { | 661 bool RenderWidget::ShouldHandleImeEvents() const { |
| 662 return GetWebWidget()->isWebFrameWidget() && has_focus_; | 662 // TODO(ekaramad): We do not track page focus for OOPIFs so for now we will |
| 663 // assume this method always returns true. | |
| 664 return GetWebWidget()->isWebFrameWidget() && (has_focus_ || for_oopif_); | |
|
alexmos
2017/02/06 23:47:46
I was a bit surprised that has_focus_ isn't tracki
EhsanK
2017/02/07 07:02:13
Yes. I did notice this issue (and explained the pr
alexmos
2017/02/08 01:42:20
Yeah, this is tricky. I've also chatted with Dani
EhsanK
2017/02/08 02:35:50
Thanks Alex.
Two comments:
1- By not finding an e
| |
| 663 } | 665 } |
| 664 | 666 |
| 665 void RenderWidget::SetWindowRectSynchronously( | 667 void RenderWidget::SetWindowRectSynchronously( |
| 666 const gfx::Rect& new_window_rect) { | 668 const gfx::Rect& new_window_rect) { |
| 667 ResizeParams params; | 669 ResizeParams params; |
| 668 params.screen_info = screen_info_; | 670 params.screen_info = screen_info_; |
| 669 params.new_size = new_window_rect.size(); | 671 params.new_size = new_window_rect.size(); |
| 670 params.physical_backing_size = | 672 params.physical_backing_size = |
| 671 gfx::ScaleToCeiledSize(new_window_rect.size(), device_scale_factor_); | 673 gfx::ScaleToCeiledSize(new_window_rect.size(), device_scale_factor_); |
| 672 params.visible_viewport_size = new_window_rect.size(); | 674 params.visible_viewport_size = new_window_rect.size(); |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1585 #endif | 1587 #endif |
| 1586 if (replacement_range.IsValid()) { | 1588 if (replacement_range.IsValid()) { |
| 1587 GetWebWidget()->applyReplacementRange( | 1589 GetWebWidget()->applyReplacementRange( |
| 1588 WebRange(replacement_range.start(), replacement_range.length())); | 1590 WebRange(replacement_range.start(), replacement_range.length())); |
| 1589 } | 1591 } |
| 1590 | 1592 |
| 1591 if (!GetWebWidget()) | 1593 if (!GetWebWidget()) |
| 1592 return; | 1594 return; |
| 1593 ImeEventGuard guard(this); | 1595 ImeEventGuard guard(this); |
| 1594 input_handler_->set_handling_input_event(true); | 1596 input_handler_->set_handling_input_event(true); |
| 1595 if (auto* controller = GetInputMethodController()) | 1597 if (auto* controller = GetInputMethodController()) { |
| 1596 controller->commitText(WebString::fromUTF16(text), | 1598 controller->commitText(WebString::fromUTF16(text), |
| 1597 WebVector<WebCompositionUnderline>(underlines), | 1599 WebVector<WebCompositionUnderline>(underlines), |
| 1598 relative_cursor_pos); | 1600 relative_cursor_pos); |
| 1601 } | |
|
EhsanK
2017/02/06 17:46:41
Just a formatting fix (irrelevant to the actual is
| |
| 1599 input_handler_->set_handling_input_event(false); | 1602 input_handler_->set_handling_input_event(false); |
| 1600 UpdateCompositionInfo(false /* not an immediate request */); | 1603 UpdateCompositionInfo(false /* not an immediate request */); |
| 1601 } | 1604 } |
| 1602 | 1605 |
| 1603 void RenderWidget::OnImeFinishComposingText(bool keep_selection) { | 1606 void RenderWidget::OnImeFinishComposingText(bool keep_selection) { |
| 1604 if (!ShouldHandleImeEvents()) | 1607 if (!ShouldHandleImeEvents()) |
| 1605 return; | 1608 return; |
| 1606 | 1609 |
| 1607 #if BUILDFLAG(ENABLE_PLUGINS) | 1610 #if BUILDFLAG(ENABLE_PLUGINS) |
| 1608 if (focused_pepper_plugin_) { | 1611 if (focused_pepper_plugin_) { |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2281 // browser side (https://crbug.com/669219). | 2284 // browser side (https://crbug.com/669219). |
| 2282 // If there is no WebFrameWidget, then there will be no | 2285 // If there is no WebFrameWidget, then there will be no |
| 2283 // InputMethodControllers for a WebLocalFrame. | 2286 // InputMethodControllers for a WebLocalFrame. |
| 2284 return nullptr; | 2287 return nullptr; |
| 2285 } | 2288 } |
| 2286 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2289 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
| 2287 ->getActiveWebInputMethodController(); | 2290 ->getActiveWebInputMethodController(); |
| 2288 } | 2291 } |
| 2289 | 2292 |
| 2290 } // namespace content | 2293 } // namespace content |
| OLD | NEW |