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

Side by Side Diff: content/renderer/render_widget.cc

Issue 720313004: Add autocapitalize support to IME support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 years, 11 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 return; 1887 return;
1888 if (show_ime == NO_SHOW_IME && !input_method_is_active_) 1888 if (show_ime == NO_SHOW_IME && !input_method_is_active_)
1889 return; 1889 return;
1890 ui::TextInputType new_type = GetTextInputType(); 1890 ui::TextInputType new_type = GetTextInputType();
1891 if (IsDateTimeInput(new_type)) 1891 if (IsDateTimeInput(new_type))
1892 return; // Not considered as a text input field in WebKit/Chromium. 1892 return; // Not considered as a text input field in WebKit/Chromium.
1893 1893
1894 blink::WebTextInputInfo new_info; 1894 blink::WebTextInputInfo new_info;
1895 if (webwidget_) 1895 if (webwidget_)
1896 new_info = webwidget_->textInputInfo(); 1896 new_info = webwidget_->textInputInfo();
1897 const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode);
1897 1898
1898 bool new_can_compose_inline = CanComposeInline(); 1899 bool new_can_compose_inline = CanComposeInline();
1899 1900
1900 // Only sends text input params if they are changed or if the ime should be 1901 // Only sends text input params if they are changed or if the ime should be
1901 // shown. 1902 // shown.
1902 if (show_ime == SHOW_IME_IF_NEEDED || 1903 if (show_ime == SHOW_IME_IF_NEEDED ||
1903 (text_input_type_ != new_type || 1904 (text_input_type_ != new_type ||
1905 text_input_mode_ != new_mode ||
1904 text_input_info_ != new_info || 1906 text_input_info_ != new_info ||
1905 can_compose_inline_ != new_can_compose_inline) 1907 can_compose_inline_ != new_can_compose_inline)
1906 #if defined(OS_ANDROID) 1908 #if defined(OS_ANDROID)
1907 || text_field_is_dirty_ 1909 || text_field_is_dirty_
1908 #endif 1910 #endif
1909 ) { 1911 ) {
1910 ViewHostMsg_TextInputState_Params p; 1912 ViewHostMsg_TextInputState_Params p;
1911 p.type = new_type; 1913 p.type = new_type;
1914 p.mode = new_mode;
1912 p.flags = new_info.flags; 1915 p.flags = new_info.flags;
1913 p.value = new_info.value.utf8(); 1916 p.value = new_info.value.utf8();
1914 p.selection_start = new_info.selectionStart; 1917 p.selection_start = new_info.selectionStart;
1915 p.selection_end = new_info.selectionEnd; 1918 p.selection_end = new_info.selectionEnd;
1916 p.composition_start = new_info.compositionStart; 1919 p.composition_start = new_info.compositionStart;
1917 p.composition_end = new_info.compositionEnd; 1920 p.composition_end = new_info.compositionEnd;
1918 p.can_compose_inline = new_can_compose_inline; 1921 p.can_compose_inline = new_can_compose_inline;
1919 p.show_ime_if_needed = (show_ime == SHOW_IME_IF_NEEDED); 1922 p.show_ime_if_needed = (show_ime == SHOW_IME_IF_NEEDED);
1920 #if defined(USE_AURA) 1923 #if defined(USE_AURA)
1921 p.is_non_ime_change = true; 1924 p.is_non_ime_change = true;
1922 #endif 1925 #endif
1923 #if defined(OS_ANDROID) 1926 #if defined(OS_ANDROID)
1924 p.is_non_ime_change = (change_source == FROM_NON_IME) || 1927 p.is_non_ime_change = (change_source == FROM_NON_IME) ||
1925 text_field_is_dirty_; 1928 text_field_is_dirty_;
1926 if (p.is_non_ime_change) 1929 if (p.is_non_ime_change)
1927 IncrementOutstandingImeEventAcks(); 1930 IncrementOutstandingImeEventAcks();
1928 text_field_is_dirty_ = false; 1931 text_field_is_dirty_ = false;
1929 #endif 1932 #endif
1930 #if defined(USE_AURA) 1933 #if defined(USE_AURA)
1931 Send(new ViewHostMsg_TextInputTypeChanged(routing_id(), 1934 Send(new ViewHostMsg_TextInputTypeChanged(routing_id(),
1932 new_type, 1935 new_type,
1933 text_input_mode_, 1936 new_mode,
1934 new_can_compose_inline, 1937 new_can_compose_inline,
1935 new_info.flags)); 1938 new_info.flags));
1936 #endif 1939 #endif
1937 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p)); 1940 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p));
1938 1941
1939 text_input_info_ = new_info; 1942 text_input_info_ = new_info;
1940 text_input_type_ = new_type; 1943 text_input_type_ = new_type;
1944 text_input_mode_ = new_mode;
1941 can_compose_inline_ = new_can_compose_inline; 1945 can_compose_inline_ = new_can_compose_inline;
1942 text_input_flags_ = new_info.flags; 1946 text_input_flags_ = new_info.flags;
1943 } 1947 }
1944 } 1948 }
1945 #endif 1949 #endif
1946 1950
1947 void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) { 1951 void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) {
1948 WebRect focus_webrect; 1952 WebRect focus_webrect;
1949 WebRect anchor_webrect; 1953 WebRect anchor_webrect;
1950 webwidget_->selectionBounds(focus_webrect, anchor_webrect); 1954 webwidget_->selectionBounds(focus_webrect, anchor_webrect);
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2376 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2373 video_hole_frames_.AddObserver(frame); 2377 video_hole_frames_.AddObserver(frame);
2374 } 2378 }
2375 2379
2376 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2380 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2377 video_hole_frames_.RemoveObserver(frame); 2381 video_hole_frames_.RemoveObserver(frame);
2378 } 2382 }
2379 #endif // defined(VIDEO_HOLE) 2383 #endif // defined(VIDEO_HOLE)
2380 2384
2381 } // namespace content 2385 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698