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

Side by Side Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp

Issue 1995333002: Handle newCursorPosition correctly for Android's commitText() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add 3 tests 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 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 return text.isEmpty() || inputMethodController.hasComposition(); 541 return text.isEmpty() || inputMethodController.hasComposition();
542 } 542 }
543 543
544 bool WebFrameWidgetImpl::confirmComposition() 544 bool WebFrameWidgetImpl::confirmComposition()
545 { 545 {
546 return confirmComposition(DoNotKeepSelection); 546 return confirmComposition(DoNotKeepSelection);
547 } 547 }
548 548
549 bool WebFrameWidgetImpl::confirmComposition(ConfirmCompositionBehavior selection Behavior) 549 bool WebFrameWidgetImpl::confirmComposition(ConfirmCompositionBehavior selection Behavior)
550 { 550 {
551 return confirmComposition(WebString(), selectionBehavior); 551 return confirmComposition(WebString(), selectionBehavior, 1);
552 } 552 }
553 553
554 bool WebFrameWidgetImpl::confirmComposition(const WebString& text) 554 bool WebFrameWidgetImpl::confirmComposition(const WebString& text, int newCursor Position)
555 { 555 {
556 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); 556 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
557 return confirmComposition(text, DoNotKeepSelection); 557 return confirmComposition(text, DoNotKeepSelection, newCursorPosition);
558 } 558 }
559 559
560 bool WebFrameWidgetImpl::confirmComposition(const WebString& text, ConfirmCompos itionBehavior selectionBehavior) const 560 bool WebFrameWidgetImpl::confirmComposition(const WebString& text, ConfirmCompos itionBehavior selectionBehavior, int newCursorPosition) const
561 { 561 {
562 LocalFrame* focused = focusedLocalFrameAvailableForIme(); 562 LocalFrame* focused = focusedLocalFrameAvailableForIme();
563 if (!focused) 563 if (!focused)
564 return false; 564 return false;
565 565
566 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) 566 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused))
567 return plugin->confirmComposition(text, selectionBehavior); 567 return plugin->confirmComposition(text, selectionBehavior, newCursorPosi tion);
568 568
569 return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : Inp utMethodController::DoNotKeepSelection); 569 return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : Inp utMethodController::DoNotKeepSelection, newCursorPosition);
570 } 570 }
571 571
572 bool WebFrameWidgetImpl::compositionRange(size_t* location, size_t* length) 572 bool WebFrameWidgetImpl::compositionRange(size_t* location, size_t* length)
573 { 573 {
574 LocalFrame* focused = focusedLocalFrameAvailableForIme(); 574 LocalFrame* focused = focusedLocalFrameAvailableForIme();
575 if (!focused) 575 if (!focused)
576 return false; 576 return false;
577 577
578 const EphemeralRange range = focused->inputMethodController().compositionEph emeralRange(); 578 const EphemeralRange range = focused->inputMethodController().compositionEph emeralRange();
579 if (range.isNull()) 579 if (range.isNull())
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 } 1457 }
1458 1458
1459 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const 1459 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const
1460 { 1460 {
1461 if (!m_imeAcceptEvents) 1461 if (!m_imeAcceptEvents)
1462 return nullptr; 1462 return nullptr;
1463 return focusedLocalFrameInWidget(); 1463 return focusedLocalFrameInWidget();
1464 } 1464 }
1465 1465
1466 } // namespace blink 1466 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698