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 "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 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 return; | 1875 return; |
1876 if (show_ime == NO_SHOW_IME && !input_method_is_active_) | 1876 if (show_ime == NO_SHOW_IME && !input_method_is_active_) |
1877 return; | 1877 return; |
1878 ui::TextInputType new_type = GetTextInputType(); | 1878 ui::TextInputType new_type = GetTextInputType(); |
1879 if (IsDateTimeInput(new_type)) | 1879 if (IsDateTimeInput(new_type)) |
1880 return; // Not considered as a text input field in WebKit/Chromium. | 1880 return; // Not considered as a text input field in WebKit/Chromium. |
1881 | 1881 |
1882 blink::WebTextInputInfo new_info; | 1882 blink::WebTextInputInfo new_info; |
1883 if (webwidget_) | 1883 if (webwidget_) |
1884 new_info = webwidget_->textInputInfo(); | 1884 new_info = webwidget_->textInputInfo(); |
| 1885 const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode); |
1885 | 1886 |
1886 bool new_can_compose_inline = CanComposeInline(); | 1887 bool new_can_compose_inline = CanComposeInline(); |
1887 | 1888 |
1888 // Only sends text input params if they are changed or if the ime should be | 1889 // Only sends text input params if they are changed or if the ime should be |
1889 // shown. | 1890 // shown. |
1890 if (show_ime == SHOW_IME_IF_NEEDED || | 1891 if (show_ime == SHOW_IME_IF_NEEDED || |
1891 (text_input_type_ != new_type || | 1892 (text_input_type_ != new_type || |
| 1893 text_input_mode_ != new_mode || |
1892 text_input_info_ != new_info || | 1894 text_input_info_ != new_info || |
1893 can_compose_inline_ != new_can_compose_inline) | 1895 can_compose_inline_ != new_can_compose_inline) |
1894 #if defined(OS_ANDROID) | 1896 #if defined(OS_ANDROID) |
1895 || text_field_is_dirty_ | 1897 || text_field_is_dirty_ |
1896 #endif | 1898 #endif |
1897 ) { | 1899 ) { |
1898 ViewHostMsg_TextInputState_Params p; | 1900 ViewHostMsg_TextInputState_Params p; |
1899 p.type = new_type; | 1901 p.type = new_type; |
| 1902 p.mode = new_mode; |
1900 p.flags = new_info.flags; | 1903 p.flags = new_info.flags; |
1901 p.value = new_info.value.utf8(); | 1904 p.value = new_info.value.utf8(); |
1902 p.selection_start = new_info.selectionStart; | 1905 p.selection_start = new_info.selectionStart; |
1903 p.selection_end = new_info.selectionEnd; | 1906 p.selection_end = new_info.selectionEnd; |
1904 p.composition_start = new_info.compositionStart; | 1907 p.composition_start = new_info.compositionStart; |
1905 p.composition_end = new_info.compositionEnd; | 1908 p.composition_end = new_info.compositionEnd; |
1906 p.can_compose_inline = new_can_compose_inline; | 1909 p.can_compose_inline = new_can_compose_inline; |
1907 p.show_ime_if_needed = (show_ime == SHOW_IME_IF_NEEDED); | 1910 p.show_ime_if_needed = (show_ime == SHOW_IME_IF_NEEDED); |
1908 #if defined(USE_AURA) | 1911 #if defined(USE_AURA) |
1909 p.is_non_ime_change = true; | 1912 p.is_non_ime_change = true; |
1910 #endif | 1913 #endif |
1911 #if defined(OS_ANDROID) | 1914 #if defined(OS_ANDROID) |
1912 p.is_non_ime_change = (change_source == FROM_NON_IME) || | 1915 p.is_non_ime_change = (change_source == FROM_NON_IME) || |
1913 text_field_is_dirty_; | 1916 text_field_is_dirty_; |
1914 if (p.is_non_ime_change) | 1917 if (p.is_non_ime_change) |
1915 IncrementOutstandingImeEventAcks(); | 1918 IncrementOutstandingImeEventAcks(); |
1916 text_field_is_dirty_ = false; | 1919 text_field_is_dirty_ = false; |
1917 #endif | 1920 #endif |
1918 #if defined(USE_AURA) | 1921 #if defined(USE_AURA) |
1919 Send(new ViewHostMsg_TextInputTypeChanged(routing_id(), | 1922 Send(new ViewHostMsg_TextInputTypeChanged(routing_id(), |
1920 new_type, | 1923 new_type, |
1921 text_input_mode_, | 1924 new_mode, |
1922 new_can_compose_inline, | 1925 new_can_compose_inline, |
1923 new_info.flags)); | 1926 new_info.flags)); |
1924 #endif | 1927 #endif |
1925 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p)); | 1928 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p)); |
1926 | 1929 |
1927 text_input_info_ = new_info; | 1930 text_input_info_ = new_info; |
1928 text_input_type_ = new_type; | 1931 text_input_type_ = new_type; |
| 1932 text_input_mode_ = new_mode; |
1929 can_compose_inline_ = new_can_compose_inline; | 1933 can_compose_inline_ = new_can_compose_inline; |
1930 text_input_flags_ = new_info.flags; | 1934 text_input_flags_ = new_info.flags; |
1931 } | 1935 } |
1932 } | 1936 } |
1933 #endif | 1937 #endif |
1934 | 1938 |
1935 void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) { | 1939 void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) { |
1936 WebRect focus_webrect; | 1940 WebRect focus_webrect; |
1937 WebRect anchor_webrect; | 1941 WebRect anchor_webrect; |
1938 webwidget_->selectionBounds(focus_webrect, anchor_webrect); | 1942 webwidget_->selectionBounds(focus_webrect, anchor_webrect); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2329 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2333 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2330 video_hole_frames_.AddObserver(frame); | 2334 video_hole_frames_.AddObserver(frame); |
2331 } | 2335 } |
2332 | 2336 |
2333 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2337 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2334 video_hole_frames_.RemoveObserver(frame); | 2338 video_hole_frames_.RemoveObserver(frame); |
2335 } | 2339 } |
2336 #endif // defined(VIDEO_HOLE) | 2340 #endif // defined(VIDEO_HOLE) |
2337 | 2341 |
2338 } // namespace content | 2342 } // namespace content |
OLD | NEW |