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

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

Issue 1995333002: Handle newCursorPosition correctly for Android's commitText() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adjust selection in confirmCompositionOrInsertText() Created 4 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 int selection_start, 1356 int selection_start,
1357 int selection_end) { 1357 int selection_end) {
1358 render_view_->OnImeSetComposition( 1358 render_view_->OnImeSetComposition(
1359 text, underlines, gfx::Range::InvalidRange(), 1359 text, underlines, gfx::Range::InvalidRange(),
1360 selection_start, selection_end); 1360 selection_start, selection_end);
1361 } 1361 }
1362 1362
1363 void RenderFrameImpl::SimulateImeConfirmComposition( 1363 void RenderFrameImpl::SimulateImeConfirmComposition(
1364 const base::string16& text, 1364 const base::string16& text,
1365 const gfx::Range& replacement_range) { 1365 const gfx::Range& replacement_range) {
1366 render_view_->OnImeConfirmComposition(text, replacement_range, false); 1366 render_view_->OnImeConfirmComposition(text, replacement_range, false, 1);
1367 } 1367 }
1368 1368
1369 void RenderFrameImpl::OnImeSetComposition( 1369 void RenderFrameImpl::OnImeSetComposition(
1370 const base::string16& text, 1370 const base::string16& text,
1371 const std::vector<blink::WebCompositionUnderline>& underlines, 1371 const std::vector<blink::WebCompositionUnderline>& underlines,
1372 int selection_start, 1372 int selection_start,
1373 int selection_end) { 1373 int selection_end) {
1374 // When a PPAPI plugin has focus, we bypass WebKit. 1374 // When a PPAPI plugin has focus, we bypass WebKit.
1375 if (!IsPepperAcceptingCompositionEvents()) { 1375 if (!IsPepperAcceptingCompositionEvents()) {
1376 pepper_composition_text_ = text; 1376 pepper_composition_text_ = text;
(...skipping 16 matching lines...) Expand all
1393 if (!pepper_composition_text_.empty()) { 1393 if (!pepper_composition_text_.empty()) {
1394 focused_pepper_plugin_->HandleCompositionUpdate( 1394 focused_pepper_plugin_->HandleCompositionUpdate(
1395 pepper_composition_text_, underlines, selection_start, selection_end); 1395 pepper_composition_text_, underlines, selection_start, selection_end);
1396 } 1396 }
1397 } 1397 }
1398 } 1398 }
1399 1399
1400 void RenderFrameImpl::OnImeConfirmComposition( 1400 void RenderFrameImpl::OnImeConfirmComposition(
1401 const base::string16& text, 1401 const base::string16& text,
1402 const gfx::Range& replacement_range, 1402 const gfx::Range& replacement_range,
1403 bool keep_selection) { 1403 bool keep_selection,
1404 int newCursorPosition) {
Changwan Ryu 2016/08/03 07:37:30 new_cursor_position
yabinh 2016/08/08 07:33:43 Done.
1404 // When a PPAPI plugin has focus, we bypass WebKit. 1405 // When a PPAPI plugin has focus, we bypass WebKit.
1405 // Here, text.empty() has a special meaning. It means to commit the last 1406 // Here, text.empty() has a special meaning. It means to commit the last
1406 // update of composition text (see 1407 // update of composition text (see
1407 // RenderWidgetHost::ImeConfirmComposition()). 1408 // RenderWidgetHost::ImeConfirmComposition()).
1408 const base::string16& last_text = text.empty() ? pepper_composition_text_ 1409 const base::string16& last_text = text.empty() ? pepper_composition_text_
1409 : text; 1410 : text;
1410 1411
1411 // last_text is empty only when both text and pepper_composition_text_ is. 1412 // last_text is empty only when both text and pepper_composition_text_ is.
1412 // Ignore it. 1413 // Ignore it.
1413 if (last_text.empty()) 1414 if (last_text.empty())
(...skipping 4933 matching lines...) Expand 10 before | Expand all | Expand 10 after
6347 // event target. Potentially a Pepper plugin will receive the event. 6348 // event target. Potentially a Pepper plugin will receive the event.
6348 // In order to tell whether a plugin gets the last mouse event and which it 6349 // In order to tell whether a plugin gets the last mouse event and which it
6349 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6350 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6350 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6351 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6351 // |pepper_last_mouse_event_target_|. 6352 // |pepper_last_mouse_event_target_|.
6352 pepper_last_mouse_event_target_ = nullptr; 6353 pepper_last_mouse_event_target_ = nullptr;
6353 #endif 6354 #endif
6354 } 6355 }
6355 6356
6356 } // namespace content 6357 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698