Index: content/renderer/render_widget.cc |
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
index 129ed07f6eb454e478f97327fc3e4969ea84065a..4dbc31cbafa4497412a20c37e987c3268f751798 100644 |
--- a/content/renderer/render_widget.cc |
+++ b/content/renderer/render_widget.cc |
@@ -252,6 +252,7 @@ RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, |
device_scale_factor_(screen_info_.deviceScaleFactor), |
#if defined(OS_ANDROID) |
text_field_is_dirty_(false), |
+ monitor_composition_info_(false), |
aelias_OOO_until_Jul13
2016/07/07 00:13:35
Please move this out of OS_ANDROID, as I don't see
Seigo Nonaka
2016/07/07 13:38:26
I don't have strong opinion to this, but this flag
aelias_OOO_until_Jul13
2016/07/07 21:15:41
Well, I think this file in general greatly overuse
|
#endif |
popup_origin_scale_for_emulation_(0.f), |
frame_swap_message_queue_(new FrameSwapMessageQueue()), |
@@ -497,6 +498,8 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) { |
IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, |
OnRequestTextInputStateUpdate) |
+ IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, |
+ OnRequestCompositionUpdate) |
IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) |
#endif |
IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) |
@@ -1371,7 +1374,8 @@ void RenderWidget::OnImeSetComposition( |
// sure we are in a consistent state. |
Send(new InputHostMsg_ImeCancelComposition(routing_id())); |
} |
- UpdateCompositionInfo(true); |
+ UpdateCompositionInfo(true /* update composition range */, |
+ false /* force update */); |
} |
void RenderWidget::OnImeConfirmComposition(const base::string16& text, |
@@ -1388,7 +1392,8 @@ void RenderWidget::OnImeConfirmComposition(const base::string16& text, |
else |
webwidget_->confirmComposition(WebWidget::DoNotKeepSelection); |
input_handler_->set_handling_input_event(false); |
- UpdateCompositionInfo(true); |
+ UpdateCompositionInfo(true /* update composition range */, |
+ false /* force update */); |
} |
void RenderWidget::OnDeviceScaleFactorChanged() { |
@@ -1469,7 +1474,12 @@ ui::TextInputType RenderWidget::GetTextInputType() { |
return ui::TEXT_INPUT_TYPE_NONE; |
} |
-void RenderWidget::UpdateCompositionInfo(bool should_update_range) { |
+void RenderWidget::UpdateCompositionInfo( |
+ bool should_update_range, bool force_update) { |
aelias_OOO_until_Jul13
2016/07/07 00:13:36
Could you rename "force_update" to "immediate_requ
Seigo Nonaka
2016/07/07 13:38:26
Done.
|
+#if defined(OS_ANDROID) |
+ if (!monitor_composition_info_) |
+ return; // Do not calculate composition info if not requested. |
aelias_OOO_until_Jul13
2016/07/07 00:13:36
I don't think it's correct to early-exit here if "
Seigo Nonaka
2016/07/07 13:38:26
Good catch! Yes, you are right!
Fixed. Thank you.
aelias_OOO_until_Jul13
2016/07/07 21:15:41
Hmm, I'm concerned that no trybot caught this bug.
Seigo Nonaka
2016/07/13 07:12:07
Sure added into ImeLolipopTest.java
|
+#endif // OS_ANDROID |
TRACE_EVENT0("renderer", "RenderWidget::UpdateCompositionInfo"); |
gfx::Range range = gfx::Range(); |
if (should_update_range) { |
@@ -1480,7 +1490,7 @@ void RenderWidget::UpdateCompositionInfo(bool should_update_range) { |
std::vector<gfx::Rect> character_bounds; |
GetCompositionCharacterBounds(&character_bounds); |
- if (!ShouldUpdateCompositionInfo(range, character_bounds)) |
+ if (!force_update && !ShouldUpdateCompositionInfo(range, character_bounds)) |
return; |
composition_character_bounds_ = character_bounds; |
composition_range_ = range; |
@@ -1538,6 +1548,15 @@ void RenderWidget::OnRequestTextInputStateUpdate() { |
UpdateSelectionBounds(); |
UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); |
} |
+ |
+void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, |
+ bool monitor_request) { |
+ monitor_composition_info_ = monitor_request; |
+ if (!immediate_request) |
+ return; |
+ UpdateCompositionInfo(true /* update composition range */, |
+ true /* force update */); |
+} |
#endif |
bool RenderWidget::ShouldHandleImeEvent() { |
@@ -1718,7 +1737,8 @@ void RenderWidget::UpdateSelectionBounds() { |
} |
} |
- UpdateCompositionInfo(false); |
+ UpdateCompositionInfo(false /* update composition range */, |
aelias_OOO_until_Jul13
2016/07/07 00:13:35
This scenario of setting update_range to false whe
Seigo Nonaka
2016/07/07 13:38:26
SelectionBoundsChanged is called when the bounding
aelias_OOO_until_Jul13
2016/07/07 21:15:41
So the caching is a pure performance optimization?
Seigo Nonaka
2016/07/13 07:12:07
Sure, I'm happy to remove this flag, but can I do
aelias_OOO_until_Jul13
2016/07/15 01:58:48
I'd ask you to do it as part this CL; the risk of
Seigo Nonaka
2016/07/20 05:42:12
Sure, finally I could make all test passing with r
|
+ false /* force update */); |
} |
void RenderWidget::SetDeviceColorProfileForTesting( |
@@ -1818,7 +1838,8 @@ void RenderWidget::resetInputMethod() { |
Send(new InputHostMsg_ImeCancelComposition(routing_id())); |
} |
- UpdateCompositionInfo(true); |
+ UpdateCompositionInfo(true /* update composition range */, |
+ false /* force update */); |
} |
#if defined(OS_ANDROID) |