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

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: Move caret within composing text. Created 4 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
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 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 int selection_start, 1316 int selection_start,
1317 int selection_end) { 1317 int selection_end) {
1318 render_view_->OnImeSetComposition( 1318 render_view_->OnImeSetComposition(
1319 text, underlines, gfx::Range::InvalidRange(), 1319 text, underlines, gfx::Range::InvalidRange(),
1320 selection_start, selection_end); 1320 selection_start, selection_end);
1321 } 1321 }
1322 1322
1323 void RenderFrameImpl::SimulateImeConfirmComposition( 1323 void RenderFrameImpl::SimulateImeConfirmComposition(
1324 const base::string16& text, 1324 const base::string16& text,
1325 const gfx::Range& replacement_range) { 1325 const gfx::Range& replacement_range) {
1326 render_view_->OnImeConfirmComposition(text, replacement_range, false); 1326 render_view_->OnImeConfirmComposition(text, replacement_range, false, 0);
1327 } 1327 }
1328 1328
1329 void RenderFrameImpl::OnImeSetComposition( 1329 void RenderFrameImpl::OnImeSetComposition(
1330 const base::string16& text, 1330 const base::string16& text,
1331 const std::vector<blink::WebCompositionUnderline>& underlines, 1331 const std::vector<blink::WebCompositionUnderline>& underlines,
1332 int selection_start, 1332 int selection_start,
1333 int selection_end) { 1333 int selection_end) {
1334 // When a PPAPI plugin has focus, we bypass WebKit. 1334 // When a PPAPI plugin has focus, we bypass WebKit.
1335 if (!IsPepperAcceptingCompositionEvents()) { 1335 if (!IsPepperAcceptingCompositionEvents()) {
1336 pepper_composition_text_ = text; 1336 pepper_composition_text_ = text;
(...skipping 16 matching lines...) Expand all
1353 if (!pepper_composition_text_.empty()) { 1353 if (!pepper_composition_text_.empty()) {
1354 focused_pepper_plugin_->HandleCompositionUpdate( 1354 focused_pepper_plugin_->HandleCompositionUpdate(
1355 pepper_composition_text_, underlines, selection_start, selection_end); 1355 pepper_composition_text_, underlines, selection_start, selection_end);
1356 } 1356 }
1357 } 1357 }
1358 } 1358 }
1359 1359
1360 void RenderFrameImpl::OnImeConfirmComposition( 1360 void RenderFrameImpl::OnImeConfirmComposition(
1361 const base::string16& text, 1361 const base::string16& text,
1362 const gfx::Range& replacement_range, 1362 const gfx::Range& replacement_range,
1363 bool keep_selection) { 1363 bool keep_selection,
1364 int relative_cursor_pos) {
1364 // When a PPAPI plugin has focus, we bypass WebKit. 1365 // When a PPAPI plugin has focus, we bypass WebKit.
1365 // Here, text.empty() has a special meaning. It means to commit the last 1366 // Here, text.empty() has a special meaning. It means to commit the last
1366 // update of composition text (see 1367 // update of composition text (see
1367 // RenderWidgetHost::ImeConfirmComposition()). 1368 // RenderWidgetHost::ImeConfirmComposition()).
1368 const base::string16& last_text = text.empty() ? pepper_composition_text_ 1369 const base::string16& last_text = text.empty() ? pepper_composition_text_
1369 : text; 1370 : text;
1370 1371
1371 // last_text is empty only when both text and pepper_composition_text_ is. 1372 // last_text is empty only when both text and pepper_composition_text_ is.
1372 // Ignore it. 1373 // Ignore it.
1373 if (last_text.empty()) 1374 if (last_text.empty())
(...skipping 4959 matching lines...) Expand 10 before | Expand all | Expand 10 after
6333 // event target. Potentially a Pepper plugin will receive the event. 6334 // event target. Potentially a Pepper plugin will receive the event.
6334 // In order to tell whether a plugin gets the last mouse event and which it 6335 // In order to tell whether a plugin gets the last mouse event and which it
6335 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6336 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6336 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6337 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6337 // |pepper_last_mouse_event_target_|. 6338 // |pepper_last_mouse_event_target_|.
6338 pepper_last_mouse_event_target_ = nullptr; 6339 pepper_last_mouse_event_target_ = nullptr;
6339 #endif 6340 #endif
6340 } 6341 }
6341 6342
6342 } // namespace content 6343 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698