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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index e1a196bd9a530b5776b7c639462f2f1f2900c35f..9d0b18b52a35a2b8927b75a894087009c2a2f628 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -513,8 +513,6 @@ void RenderWidgetHostViewBase::GetDefaultScreenInfo(
RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
bool is_guest_view_hack)
: render_widget_host_(RenderWidgetHostImpl::From(widget)),
- text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
- can_compose_inline_(true),
browser_compositor_state_(BrowserCompositorDestroyed),
browser_compositor_placeholder_(new BrowserCompositorMacPlaceholder),
page_at_minimum_scale_(true),
@@ -1015,23 +1013,24 @@ void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) {
// like Chrome does on Windows, call |UpdateCursor()| here.
}
-void RenderWidgetHostViewMac::TextInputStateChanged(
-const ViewHostMsg_TextInputState_Params& params) {
- if (text_input_type_ != params.type
- || can_compose_inline_ != params.can_compose_inline) {
- text_input_type_ = params.type;
- can_compose_inline_ = params.can_compose_inline;
- if (HasFocus()) {
- SetTextInputActive(true);
+void RenderWidgetHostViewMac::UpdateTextInputState() {
+ RenderWidgetHostViewBase* focused_view = GetFocusedView();
+ if (!focused_view->ShouldProcessTextInputState())
+ return;
+
+ cached_text_input_state_ = focused_view->text_input_state();
- // Let AppKit cache the new input context to make IMEs happy.
- // See http://crbug.com/73039.
- [NSApp updateWindows];
+ if (HasFocus()) {
+ SetTextInputActive(true);
+
+ // Let AppKit cache the new input context to make IMEs happy.
+ // See http://crbug.com/73039.
+ [NSApp updateWindows];
#ifndef __LP64__
- UseInputWindow(TSMGetActiveDocument(), !can_compose_inline_);
+ UseInputWindow(TSMGetActiveDocument(),
+ focused_view->text_input_state() _->can_compose_inline_);
#endif
- }
}
}
@@ -1716,12 +1715,12 @@ gfx::Point RenderWidgetHostViewMac::AccessibilityOriginInScreen(
void RenderWidgetHostViewMac::SetTextInputActive(bool active) {
if (active) {
- if (text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD)
+ if (current_text_input_state()->type == ui::TEXT_INPUT_TYPE_PASSWORD)
EnablePasswordInput();
else
DisablePasswordInput();
} else {
- if (text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD)
+ if (current_text_input_state()->type == ui::TEXT_INPUT_TYPE_PASSWORD)
DisablePasswordInput();
}
}
@@ -3076,7 +3075,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
if (focusedPluginIdentifier_ != -1)
return [[ComplexTextInputPanel sharedComplexTextInputPanel] inputContext];
- switch(renderWidgetHostView_->text_input_type_) {
+ switch (renderWidgetHostView_->current_text_input_state()->type) {
case ui::TEXT_INPUT_TYPE_NONE:
case ui::TEXT_INPUT_TYPE_PASSWORD:
return nil;
@@ -3411,8 +3410,8 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
BOOL sendTypeIsString = [sendType isEqual:NSStringPboardType];
BOOL returnTypeIsString = [returnType isEqual:NSStringPboardType];
BOOL hasText = !renderWidgetHostView_->selected_text().empty();
- BOOL takesText =
- renderWidgetHostView_->text_input_type_ != ui::TEXT_INPUT_TYPE_NONE;
+ BOOL takesText = renderWidgetHostView_->current_text_input_state()->type !=
+ ui::TEXT_INPUT_TYPE_NONE;
if (sendTypeIsString && hasText && !returnType) {
requestor = self;

Powered by Google App Engine
This is Rietveld 408576698