Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 1652483002: Browser Side Text Input State Tracking for OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using the Old Logic for Determining the State Change Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 bool is_guest_view_hack) 455 bool is_guest_view_hack)
456 : host_(RenderWidgetHostImpl::From(host)), 456 : host_(RenderWidgetHostImpl::From(host)),
457 window_(nullptr), 457 window_(nullptr),
458 delegated_frame_host_(new DelegatedFrameHost(this)), 458 delegated_frame_host_(new DelegatedFrameHost(this)),
459 in_shutdown_(false), 459 in_shutdown_(false),
460 in_bounds_changed_(false), 460 in_bounds_changed_(false),
461 is_fullscreen_(false), 461 is_fullscreen_(false),
462 popup_parent_host_view_(NULL), 462 popup_parent_host_view_(NULL),
463 popup_child_host_view_(NULL), 463 popup_child_host_view_(NULL),
464 is_loading_(false), 464 is_loading_(false),
465 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
466 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
467 text_input_flags_(0),
468 can_compose_inline_(true),
469 has_composition_text_(false), 465 has_composition_text_(false),
470 accept_return_character_(false), 466 accept_return_character_(false),
471 last_swapped_software_frame_scale_factor_(1.f), 467 last_swapped_software_frame_scale_factor_(1.f),
472 paint_canvas_(NULL), 468 paint_canvas_(NULL),
473 synthetic_move_sent_(false), 469 synthetic_move_sent_(false),
474 cursor_visibility_state_in_renderer_(UNKNOWN), 470 cursor_visibility_state_in_renderer_(UNKNOWN),
475 #if defined(OS_WIN) 471 #if defined(OS_WIN)
476 legacy_render_widget_host_HWND_(NULL), 472 legacy_render_widget_host_HWND_(NULL),
477 legacy_window_destroyed_(false), 473 legacy_window_destroyed_(false),
478 #endif 474 #endif
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_); 999 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_);
1004 current_cursor_.SetDisplayInfo(display); 1000 current_cursor_.SetDisplayInfo(display);
1005 UpdateCursorIfOverSelf(); 1001 UpdateCursorIfOverSelf();
1006 } 1002 }
1007 1003
1008 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { 1004 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) {
1009 is_loading_ = is_loading; 1005 is_loading_ = is_loading;
1010 UpdateCursorIfOverSelf(); 1006 UpdateCursorIfOverSelf();
1011 } 1007 }
1012 1008
1013 void RenderWidgetHostViewAura::TextInputStateChanged( 1009 void RenderWidgetHostViewAura::UpdateTextInputState() {
1014 const ViewHostMsg_TextInputState_Params& params) { 1010 if (!GetInputMethod())
1015 if (text_input_type_ != params.type || 1011 return;
1016 text_input_mode_ != params.mode || 1012
1017 can_compose_inline_ != params.can_compose_inline || 1013 RenderWidgetHostViewBase* focused_view = GetFocusedView();
1018 text_input_flags_ != params.flags) { 1014 const TextInputState* state = focused_view->text_input_state();
1019 text_input_type_ = params.type; 1015
1020 text_input_mode_ = params.mode; 1016 if (focused_view->ShouldProcessTextInputState()) {
EhsanK 2016/03/08 05:21:03 This function must only return true, and the code
1021 can_compose_inline_ = params.can_compose_inline; 1017 cached_text_input_state_ = state;
1022 text_input_flags_ = params.flags; 1018 GetInputMethod()->OnTextInputTypeChanged(this);
1023 if (GetInputMethod())
1024 GetInputMethod()->OnTextInputTypeChanged(this);
1025 } 1019 }
1026 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { 1020
1027 if (GetInputMethod()) 1021 if (state->show_ime_if_needed && state->type != ui::TEXT_INPUT_TYPE_NONE)
EhsanK 2016/03/08 05:21:03 This one also will be called regardless of whether
1028 GetInputMethod()->ShowImeIfNeeded(); 1022 GetInputMethod()->ShowImeIfNeeded();
1029 }
1030 } 1023 }
1031 1024
1032 void RenderWidgetHostViewAura::ImeCancelComposition() { 1025 void RenderWidgetHostViewAura::ImeCancelComposition() {
1033 if (GetInputMethod()) 1026 if (GetInputMethod())
1034 GetInputMethod()->CancelComposition(this); 1027 GetInputMethod()->CancelComposition(this);
1035 has_composition_text_ = false; 1028 has_composition_text_ = false;
1036 } 1029 }
1037 1030
1038 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( 1031 void RenderWidgetHostViewAura::ImeCompositionRangeChanged(
1039 const gfx::Range& range, 1032 const gfx::Range& range,
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 } 1645 }
1653 1646
1654 void RenderWidgetHostViewAura::ClearCompositionText() { 1647 void RenderWidgetHostViewAura::ClearCompositionText() {
1655 // TODO(wjmaclean): can host_ ever be null? 1648 // TODO(wjmaclean): can host_ ever be null?
1656 if (host_ && has_composition_text_) 1649 if (host_ && has_composition_text_)
1657 host_->ImeCancelComposition(); 1650 host_->ImeCancelComposition();
1658 has_composition_text_ = false; 1651 has_composition_text_ = false;
1659 } 1652 }
1660 1653
1661 void RenderWidgetHostViewAura::InsertText(const base::string16& text) { 1654 void RenderWidgetHostViewAura::InsertText(const base::string16& text) {
1662 DCHECK(text_input_type_ != ui::TEXT_INPUT_TYPE_NONE); 1655 DCHECK(cached_text_input_state_->type != ui::TEXT_INPUT_TYPE_NONE);
1663 // TODO(wjmaclean): can host_ ever be null? 1656 // TODO(wjmaclean): can host_ ever be null?
1664 if (host_) 1657 if (host_)
1665 host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false); 1658 host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false);
1666 has_composition_text_ = false; 1659 has_composition_text_ = false;
1667 } 1660 }
1668 1661
1669 void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) { 1662 void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) {
1670 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { 1663 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) {
1671 popup_child_host_view_->InsertChar(event); 1664 popup_child_host_view_->InsertChar(event);
1672 return; 1665 return;
1673 } 1666 }
1674 1667
1675 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 1668 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547
1676 // TODO(wjmaclean): can host_ ever be null? 1669 // TODO(wjmaclean): can host_ ever be null?
1677 if (host_ && 1670 if (host_ &&
1678 (accept_return_character_ || event.GetCharacter() != ui::VKEY_RETURN)) { 1671 (accept_return_character_ || event.GetCharacter() != ui::VKEY_RETURN)) {
1679 // Send a blink::WebInputEvent::Char event to |host_|. 1672 // Send a blink::WebInputEvent::Char event to |host_|.
1680 ForwardKeyboardEvent(NativeWebKeyboardEvent(event, event.GetCharacter())); 1673 ForwardKeyboardEvent(NativeWebKeyboardEvent(event, event.GetCharacter()));
1681 } 1674 }
1682 } 1675 }
1683 1676
1684 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { 1677 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const {
1685 return text_input_type_; 1678 return cached_text_input_state_->type;
1686 } 1679 }
1687 1680
1688 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const { 1681 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const {
1689 return text_input_mode_; 1682 return cached_text_input_state_->mode;
1690 } 1683 }
1691 1684
1692 int RenderWidgetHostViewAura::GetTextInputFlags() const { 1685 int RenderWidgetHostViewAura::GetTextInputFlags() const {
1693 return text_input_flags_; 1686 return cached_text_input_state_->flags;
1694 } 1687 }
1695 1688
1696 bool RenderWidgetHostViewAura::CanComposeInline() const { 1689 bool RenderWidgetHostViewAura::CanComposeInline() const {
1697 return can_compose_inline_; 1690 return cached_text_input_state_->can_compose_inline;
1698 } 1691 }
1699 1692
1700 gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen( 1693 gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(
1701 const gfx::Rect& rect) const { 1694 const gfx::Rect& rect) const {
1702 gfx::Point origin = rect.origin(); 1695 gfx::Point origin = rect.origin();
1703 gfx::Point end = gfx::Point(rect.right(), rect.bottom()); 1696 gfx::Point end = gfx::Point(rect.right(), rect.bottom());
1704 1697
1705 aura::Window* root_window = window_->GetRootWindow(); 1698 aura::Window* root_window = window_->GetRootWindow();
1706 if (!root_window) 1699 if (!root_window)
1707 return rect; 1700 return rect;
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
3110 3103
3111 //////////////////////////////////////////////////////////////////////////////// 3104 ////////////////////////////////////////////////////////////////////////////////
3112 // RenderWidgetHostViewBase, public: 3105 // RenderWidgetHostViewBase, public:
3113 3106
3114 // static 3107 // static
3115 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 3108 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
3116 GetScreenInfoForWindow(results, NULL); 3109 GetScreenInfoForWindow(results, NULL);
3117 } 3110 }
3118 3111
3119 } // namespace content 3112 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698