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

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: Sync. Almost the same to the previous patch. 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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 int selection_start, 1320 int selection_start,
1321 int selection_end) { 1321 int selection_end) {
1322 render_view_->OnImeSetComposition( 1322 render_view_->OnImeSetComposition(
1323 text, underlines, gfx::Range::InvalidRange(), 1323 text, underlines, gfx::Range::InvalidRange(),
1324 selection_start, selection_end); 1324 selection_start, selection_end);
1325 } 1325 }
1326 1326
1327 void RenderFrameImpl::SimulateImeConfirmComposition( 1327 void RenderFrameImpl::SimulateImeConfirmComposition(
1328 const base::string16& text, 1328 const base::string16& text,
1329 const gfx::Range& replacement_range) { 1329 const gfx::Range& replacement_range) {
1330 render_view_->OnImeConfirmComposition(text, replacement_range, false); 1330 render_view_->OnImeConfirmComposition(text, replacement_range, false, 1);
1331 } 1331 }
1332 1332
1333 void RenderFrameImpl::OnImeSetComposition( 1333 void RenderFrameImpl::OnImeSetComposition(
1334 const base::string16& text, 1334 const base::string16& text,
1335 const std::vector<blink::WebCompositionUnderline>& underlines, 1335 const std::vector<blink::WebCompositionUnderline>& underlines,
1336 int selection_start, 1336 int selection_start,
1337 int selection_end) { 1337 int selection_end) {
1338 // When a PPAPI plugin has focus, we bypass WebKit. 1338 // When a PPAPI plugin has focus, we bypass WebKit.
1339 if (!IsPepperAcceptingCompositionEvents()) { 1339 if (!IsPepperAcceptingCompositionEvents()) {
1340 pepper_composition_text_ = text; 1340 pepper_composition_text_ = text;
(...skipping 16 matching lines...) Expand all
1357 if (!pepper_composition_text_.empty()) { 1357 if (!pepper_composition_text_.empty()) {
1358 focused_pepper_plugin_->HandleCompositionUpdate( 1358 focused_pepper_plugin_->HandleCompositionUpdate(
1359 pepper_composition_text_, underlines, selection_start, selection_end); 1359 pepper_composition_text_, underlines, selection_start, selection_end);
1360 } 1360 }
1361 } 1361 }
1362 } 1362 }
1363 1363
1364 void RenderFrameImpl::OnImeConfirmComposition( 1364 void RenderFrameImpl::OnImeConfirmComposition(
1365 const base::string16& text, 1365 const base::string16& text,
1366 const gfx::Range& replacement_range, 1366 const gfx::Range& replacement_range,
1367 bool keep_selection) { 1367 bool keep_selection,
1368 int new_cursor_pos) {
1368 // When a PPAPI plugin has focus, we bypass WebKit. 1369 // When a PPAPI plugin has focus, we bypass WebKit.
1369 // Here, text.empty() has a special meaning. It means to commit the last 1370 // Here, text.empty() has a special meaning. It means to commit the last
1370 // update of composition text (see 1371 // update of composition text (see
1371 // RenderWidgetHost::ImeConfirmComposition()). 1372 // RenderWidgetHost::ImeConfirmComposition()).
1372 const base::string16& last_text = text.empty() ? pepper_composition_text_ 1373 const base::string16& last_text = text.empty() ? pepper_composition_text_
1373 : text; 1374 : text;
1374 1375
1375 // last_text is empty only when both text and pepper_composition_text_ is. 1376 // last_text is empty only when both text and pepper_composition_text_ is.
1376 // Ignore it. 1377 // Ignore it.
1377 if (last_text.empty()) 1378 if (last_text.empty())
(...skipping 4975 matching lines...) Expand 10 before | Expand all | Expand 10 after
6353 // event target. Potentially a Pepper plugin will receive the event. 6354 // event target. Potentially a Pepper plugin will receive the event.
6354 // In order to tell whether a plugin gets the last mouse event and which it 6355 // In order to tell whether a plugin gets the last mouse event and which it
6355 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6356 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6356 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6357 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6357 // |pepper_last_mouse_event_target_|. 6358 // |pepper_last_mouse_event_target_|.
6358 pepper_last_mouse_event_target_ = nullptr; 6359 pepper_last_mouse_event_target_ = nullptr;
6359 #endif 6360 #endif
6360 } 6361 }
6361 6362
6362 } // namespace content 6363 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698