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 "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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1052 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( | 1052 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( |
| 1053 &handling_event_type_, input_event->type); | 1053 &handling_event_type_, input_event->type); |
| 1054 | 1054 |
| 1055 // Calls into |didOverscroll()| while handling this event will populate | 1055 // Calls into |didOverscroll()| while handling this event will populate |
| 1056 // |event_overscroll|, which in turn will be bundled with the event ack. | 1056 // |event_overscroll|, which in turn will be bundled with the event ack. |
| 1057 scoped_ptr<DidOverscrollParams> event_overscroll; | 1057 scoped_ptr<DidOverscrollParams> event_overscroll; |
| 1058 base::AutoReset<scoped_ptr<DidOverscrollParams>*> | 1058 base::AutoReset<scoped_ptr<DidOverscrollParams>*> |
| 1059 handling_event_overscroll_resetter(&handling_event_overscroll_, | 1059 handling_event_overscroll_resetter(&handling_event_overscroll_, |
| 1060 &event_overscroll); | 1060 &event_overscroll); |
| 1061 | 1061 |
| 1062 #if defined(OS_ANDROID) | 1062 #if defined(OS_ANDROID) |
|
aelias_OOO_until_Jul13
2015/10/22 00:07:56
Let's delete this OS_ANDROID.
Changwan Ryu
2015/10/22 02:46:00
Done. (try is still running).
| |
| 1063 // On Android, when a key is pressed or sent from the Keyboard using IME, | 1063 // On Android, when a key is pressed or sent from the Keyboard using IME, |
| 1064 // |AdapterInputConnection| generates input key events to make sure all JS | 1064 // |AdapterInputConnection| generates input key events to make sure all JS |
| 1065 // listeners that monitor KeyUp and KeyDown events receive the proper key | 1065 // listeners that monitor KeyUp and KeyDown events receive the proper key |
| 1066 // code. Since this input key event comes from IME, we need to set the | 1066 // code. Since this input key event comes from IME, we need to set the |
| 1067 // IME event guard here to make sure it does not interfere with other IME | 1067 // IME event guard here to make sure it does not interfere with other IME |
| 1068 // events. | 1068 // events. |
| 1069 scoped_ptr<ImeEventGuard> ime_event_guard_maybe; | 1069 scoped_ptr<ImeEventGuard> ime_event_guard_maybe; |
|
aelias_OOO_until_Jul13
2015/10/22 00:07:56
We can unconditionally create the IME guard here,
Changwan Ryu
2015/10/22 02:46:00
This is a great idea! In order to implement it I h
| |
| 1070 if (WebInputEvent::isKeyboardEventType(input_event->type)) { | 1070 if (WebInputEvent::isKeyboardEventType(input_event->type)) { |
| 1071 const WebKeyboardEvent& key_event = | 1071 const WebKeyboardEvent& key_event = |
| 1072 *static_cast<const WebKeyboardEvent*>(input_event); | 1072 *static_cast<const WebKeyboardEvent*>(input_event); |
| 1073 // Some keys are special and it's essential that no events get blocked. | 1073 // Some keys are special and it's essential that no events get blocked. |
| 1074 if (key_event.nativeKeyCode != AKEYCODE_TAB && | 1074 if (key_event.nativeKeyCode != AKEYCODE_TAB && |
| 1075 key_event.nativeKeyCode != AKEYCODE_DPAD_CENTER && | 1075 key_event.nativeKeyCode != AKEYCODE_DPAD_CENTER && |
| 1076 key_event.nativeKeyCode != AKEYCODE_DPAD_LEFT && | 1076 key_event.nativeKeyCode != AKEYCODE_DPAD_LEFT && |
| 1077 key_event.nativeKeyCode != AKEYCODE_DPAD_RIGHT && | 1077 key_event.nativeKeyCode != AKEYCODE_DPAD_RIGHT && |
| 1078 key_event.nativeKeyCode != AKEYCODE_DPAD_UP && | 1078 key_event.nativeKeyCode != AKEYCODE_DPAD_UP && |
| 1079 key_event.nativeKeyCode != AKEYCODE_DPAD_DOWN) | 1079 key_event.nativeKeyCode != AKEYCODE_DPAD_DOWN) |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1879 UpdateSelectionBounds(); | 1879 UpdateSelectionBounds(); |
| 1880 #if defined(OS_ANDROID) | 1880 #if defined(OS_ANDROID) |
| 1881 UpdateTextInputState(NO_SHOW_IME, FROM_IME); | 1881 UpdateTextInputState(NO_SHOW_IME, FROM_IME); |
| 1882 #endif | 1882 #endif |
| 1883 } | 1883 } |
| 1884 | 1884 |
| 1885 void RenderWidget::UpdateTextInputState(ShowIme show_ime, | 1885 void RenderWidget::UpdateTextInputState(ShowIme show_ime, |
| 1886 ChangeSource change_source) { | 1886 ChangeSource change_source) { |
| 1887 TRACE_EVENT0("renderer", "RenderWidget::UpdateTextInputState"); | 1887 TRACE_EVENT0("renderer", "RenderWidget::UpdateTextInputState"); |
| 1888 if (handling_ime_event_) | 1888 if (handling_ime_event_) |
| 1889 return; | 1889 return; |
|
aelias_OOO_until_Jul13
2015/10/22 00:07:56
Prior to this early return, I think we should do '
Changwan Ryu
2015/10/22 02:46:00
Hmm... Since we do not store show_ime_, I came up
| |
| 1890 ui::TextInputType new_type = GetTextInputType(); | 1890 |
| 1891 // We could be called in the middle of focus change, or in some other | |
| 1892 // intermediary state. | |
| 1893 base::ThreadTaskRunnerHandle::Get()->PostTask( | |
| 1894 FROM_HERE, base::Bind(&RenderWidget::UpdateTextInputStateInternal, this, | |
| 1895 show_ime, change_source)); | |
| 1896 } | |
| 1897 | |
| 1898 void RenderWidget::UpdateTextInputStateInternal(ShowIme show_ime, | |
| 1899 ChangeSource change_source) { | |
| 1900 blink::WebTextInputInfo new_info; | |
| 1901 if (webwidget_) | |
| 1902 new_info = webwidget_->textInputInfo(); | |
| 1903 | |
| 1904 ui::TextInputType new_type = WebKitToUiTextInputType(new_info.type); | |
| 1891 if (IsDateTimeInput(new_type)) | 1905 if (IsDateTimeInput(new_type)) |
| 1892 return; // Not considered as a text input field in WebKit/Chromium. | 1906 return; // Not considered as a text input field in WebKit/Chromium. |
| 1893 | 1907 |
| 1894 blink::WebTextInputInfo new_info; | |
| 1895 if (webwidget_) | |
| 1896 new_info = webwidget_->textInputInfo(); | |
| 1897 const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode); | 1908 const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode); |
| 1898 | 1909 |
| 1899 bool new_can_compose_inline = CanComposeInline(); | 1910 bool new_can_compose_inline = CanComposeInline(); |
| 1900 | 1911 |
| 1901 // Only sends text input params if they are changed or if the ime should be | 1912 // Only sends text input params if they are changed or if the ime should be |
| 1902 // shown. | 1913 // shown. |
| 1903 if (show_ime == SHOW_IME_IF_NEEDED || | 1914 if (show_ime == SHOW_IME_IF_NEEDED || |
| 1904 (text_input_type_ != new_type || | 1915 (text_input_type_ != new_type || |
| 1905 text_input_mode_ != new_mode || | 1916 text_input_mode_ != new_mode || |
| 1906 text_input_info_ != new_info || | 1917 text_input_info_ != new_info || |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2382 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2393 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2383 video_hole_frames_.AddObserver(frame); | 2394 video_hole_frames_.AddObserver(frame); |
| 2384 } | 2395 } |
| 2385 | 2396 |
| 2386 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2397 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2387 video_hole_frames_.RemoveObserver(frame); | 2398 video_hole_frames_.RemoveObserver(frame); |
| 2388 } | 2399 } |
| 2389 #endif // defined(VIDEO_HOLE) | 2400 #endif // defined(VIDEO_HOLE) |
| 2390 | 2401 |
| 2391 } // namespace content | 2402 } // namespace content |
| OLD | NEW |