OLD | NEW |
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 Loading... |
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 relativeC
aretPosition) |
555 { | 555 { |
556 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); | 556 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); |
557 return confirmComposition(text, DoNotKeepSelection); | 557 return confirmComposition(text, DoNotKeepSelection, relativeCaretPosition); |
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 relativeCaretPosition) 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, relativeCaret
Position); |
568 | 568 |
569 return focused->inputMethodController().confirmCompositionOrInsertText(text,
selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : Inp
utMethodController::DoNotKeepSelection); | 569 if (selectionBehavior == KeepSelection) |
| 570 return focused->inputMethodController().commitComposition(text); |
| 571 |
| 572 return focused->inputMethodController().commitCompositionAndMoveCaret(text,
relativeCaretPosition); |
570 } | 573 } |
571 | 574 |
572 bool WebFrameWidgetImpl::compositionRange(size_t* location, size_t* length) | 575 bool WebFrameWidgetImpl::compositionRange(size_t* location, size_t* length) |
573 { | 576 { |
574 LocalFrame* focused = focusedLocalFrameAvailableForIme(); | 577 LocalFrame* focused = focusedLocalFrameAvailableForIme(); |
575 if (!focused) | 578 if (!focused) |
576 return false; | 579 return false; |
577 | 580 |
578 const EphemeralRange range = focused->inputMethodController().compositionEph
emeralRange(); | 581 const EphemeralRange range = focused->inputMethodController().compositionEph
emeralRange(); |
579 if (range.isNull()) | 582 if (range.isNull()) |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 } | 1460 } |
1458 | 1461 |
1459 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const | 1462 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const |
1460 { | 1463 { |
1461 if (!m_imeAcceptEvents) | 1464 if (!m_imeAcceptEvents) |
1462 return nullptr; | 1465 return nullptr; |
1463 return focusedLocalFrameInWidget(); | 1466 return focusedLocalFrameInWidget(); |
1464 } | 1467 } |
1465 | 1468 |
1466 } // namespace blink | 1469 } // namespace blink |
OLD | NEW |