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

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

Issue 10962011: Allow tap gestures to open the IME on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 // As two different kinds of events could cause us to postpone an ack 598 // As two different kinds of events could cause us to postpone an ack
599 // we send it now, if we have one pending. The Browser should never 599 // we send it now, if we have one pending. The Browser should never
600 // send us the same kind of event we are delaying the ack for. 600 // send us the same kind of event we are delaying the ack for.
601 Send(pending_input_event_ack_.release()); 601 Send(pending_input_event_ack_.release());
602 } 602 }
603 pending_input_event_ack_.reset(response); 603 pending_input_event_ack_.reset(response);
604 } else { 604 } else {
605 Send(response); 605 Send(response);
606 } 606 }
607 607
608 #if defined(OS_ANDROID)
609 // Allow the IME to be shown when the focus changes as a consequence
610 // of a processed touch end event.
611 if (input_event->type == WebInputEvent::TouchEnd && processed)
612 UpdateTextInputState(SHOW_IME_IF_NEEDED);
613 #endif
614
608 handling_input_event_ = false; 615 handling_input_event_ = false;
609 616
610 if (!prevent_default) { 617 if (!prevent_default) {
611 if (WebInputEvent::isKeyboardEventType(input_event->type)) 618 if (WebInputEvent::isKeyboardEventType(input_event->type))
612 DidHandleKeyEvent(); 619 DidHandleKeyEvent();
613 if (WebInputEvent::isMouseEventType(input_event->type)) 620 if (WebInputEvent::isMouseEventType(input_event->type))
614 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event))); 621 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event)));
615 if (WebInputEvent::isTouchEventType(input_event->type)) 622 if (WebInputEvent::isTouchEventType(input_event->type))
616 DidHandleTouchEvent(*(static_cast<const WebTouchEvent*>(input_event))); 623 DidHandleTouchEvent(*(static_cast<const WebTouchEvent*>(input_event)));
617 } 624 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 AnimateIfNeeded(); 873 AnimateIfNeeded();
867 874
868 // Layout may generate more invalidation. It may also enable the 875 // Layout may generate more invalidation. It may also enable the
869 // GPU acceleration, so make sure to run layout before we send the 876 // GPU acceleration, so make sure to run layout before we send the
870 // GpuRenderingActivated message. 877 // GpuRenderingActivated message.
871 webwidget_->layout(); 878 webwidget_->layout();
872 879
873 // The following two can result in further layout and possibly 880 // The following two can result in further layout and possibly
874 // enable GPU acceleration so they need to be called before any painting 881 // enable GPU acceleration so they need to be called before any painting
875 // is done. 882 // is done.
876 UpdateTextInputState(); 883 UpdateTextInputState(DO_NOT_SHOW_IME);
877 UpdateSelectionBounds(); 884 UpdateSelectionBounds();
878 885
879 // Suppress painting if nothing is dirty. This has to be done after updating 886 // Suppress painting if nothing is dirty. This has to be done after updating
880 // animations running layout as these may generate further invalidations. 887 // animations running layout as these may generate further invalidations.
881 if (!paint_aggregator_.HasPendingUpdate()) { 888 if (!paint_aggregator_.HasPendingUpdate()) {
882 TRACE_EVENT0("renderer", "EarlyOut_NoPendingUpdate"); 889 TRACE_EVENT0("renderer", "EarlyOut_NoPendingUpdate");
883 webwidget_->instrumentCancelFrame(); 890 webwidget_->instrumentCancelFrame();
884 return; 891 return;
885 } 892 }
886 893
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 } 1163 }
1157 1164
1158 void RenderWidget::willBeginCompositorFrame() { 1165 void RenderWidget::willBeginCompositorFrame() {
1159 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); 1166 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame");
1160 1167
1161 DCHECK(RenderThreadImpl::current()->compositor_thread()); 1168 DCHECK(RenderThreadImpl::current()->compositor_thread());
1162 1169
1163 // The following two can result in further layout and possibly 1170 // The following two can result in further layout and possibly
1164 // enable GPU acceleration so they need to be called before any painting 1171 // enable GPU acceleration so they need to be called before any painting
1165 // is done. 1172 // is done.
1166 UpdateTextInputState(); 1173 UpdateTextInputState(DO_NOT_SHOW_IME);
1167 UpdateSelectionBounds(); 1174 UpdateSelectionBounds();
1168 1175
1169 WillInitiatePaint(); 1176 WillInitiatePaint();
1170 } 1177 }
1171 1178
1172 void RenderWidget::didBecomeReadyForAdditionalInput() { 1179 void RenderWidget::didBecomeReadyForAdditionalInput() {
1173 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); 1180 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput");
1174 if (pending_input_event_ack_.get()) 1181 if (pending_input_event_ack_.get())
1175 Send(pending_input_event_ack_.release()); 1182 Send(pending_input_event_ack_.release());
1176 } 1183 }
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 } 1637 }
1631 1638
1632 void RenderWidget::set_next_paint_is_restore_ack() { 1639 void RenderWidget::set_next_paint_is_restore_ack() {
1633 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_RESTORE_ACK; 1640 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_RESTORE_ACK;
1634 } 1641 }
1635 1642
1636 void RenderWidget::set_next_paint_is_repaint_ack() { 1643 void RenderWidget::set_next_paint_is_repaint_ack() {
1637 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK; 1644 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK;
1638 } 1645 }
1639 1646
1640 void RenderWidget::UpdateTextInputState() { 1647 void RenderWidget::UpdateTextInputState(ShowIme show_ime) {
1641 if (!input_method_is_active_) 1648 bool show_ime_if_needed = (show_ime == SHOW_IME_IF_NEEDED);
1649 if (!show_ime_if_needed && !input_method_is_active_)
1642 return; 1650 return;
1643 ui::TextInputType new_type = GetTextInputType(); 1651 ui::TextInputType new_type = GetTextInputType();
1644 WebKit::WebTextInputInfo new_info; 1652 WebKit::WebTextInputInfo new_info;
1645 if (webwidget_) 1653 if (webwidget_)
1646 new_info = webwidget_->textInputInfo(); 1654 new_info = webwidget_->textInputInfo();
1647 1655
1648 bool new_can_compose_inline = CanComposeInline(); 1656 bool new_can_compose_inline = CanComposeInline();
1649 1657
1650 // Only sends text input params if they are changed. 1658 // Only sends text input params if they are changed or if the ime should be
1651 if (text_input_type_ != new_type || text_input_info_ != new_info 1659 // shown.
1652 || can_compose_inline_ != new_can_compose_inline) { 1660 if (show_ime_if_needed || (text_input_type_ != new_type
1661 || text_input_info_ != new_info
1662 || can_compose_inline_ != new_can_compose_inline)) {
1653 ViewHostMsg_TextInputState_Params p; 1663 ViewHostMsg_TextInputState_Params p;
1654 p.type = new_type; 1664 p.type = new_type;
1655 p.value = new_info.value.utf8(); 1665 p.value = new_info.value.utf8();
1656 p.selection_start = new_info.selectionStart; 1666 p.selection_start = new_info.selectionStart;
1657 p.selection_end = new_info.selectionEnd; 1667 p.selection_end = new_info.selectionEnd;
1658 p.composition_start = new_info.compositionStart; 1668 p.composition_start = new_info.compositionStart;
1659 p.composition_end = new_info.compositionEnd; 1669 p.composition_end = new_info.compositionEnd;
1660 p.can_compose_inline = new_can_compose_inline; 1670 p.can_compose_inline = new_can_compose_inline;
1671 p.show_ime_if_needed = show_ime_if_needed;
1661 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p)); 1672 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p));
1662 1673
1663 text_input_info_ = new_info; 1674 text_input_info_ = new_info;
1664 text_input_type_ = new_type; 1675 text_input_type_ = new_type;
1665 can_compose_inline_ = new_can_compose_inline; 1676 can_compose_inline_ = new_can_compose_inline;
1666 } 1677 }
1667 } 1678 }
1668 1679
1669 void RenderWidget::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { 1680 void RenderWidget::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) {
1670 WebRect start_webrect; 1681 WebRect start_webrect;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 pending_smooth_scroll_gestures_.insert(std::make_pair(id, callback)); 1863 pending_smooth_scroll_gestures_.insert(std::make_pair(id, callback));
1853 } 1864 }
1854 1865
1855 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 1866 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
1856 return false; 1867 return false;
1857 } 1868 }
1858 1869
1859 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1870 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1860 return false; 1871 return false;
1861 } 1872 }
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698