Chromium Code Reviews| 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 537 // selectionStart and selectionEnd, WebKit somehow won't paint the selection | 537 // selectionStart and selectionEnd, WebKit somehow won't paint the selection |
| 538 // at all (see InlineTextBox::paint() function in InlineTextBox.cpp). | 538 // at all (see InlineTextBox::paint() function in InlineTextBox.cpp). |
| 539 // But the selection range actually takes effect. | 539 // But the selection range actually takes effect. |
| 540 inputMethodController.setComposition(String(text), | 540 inputMethodController.setComposition(String(text), |
| 541 CompositionUnderlineVectorBuilder(underlines), | 541 CompositionUnderlineVectorBuilder(underlines), |
| 542 selectionStart, selectionEnd); | 542 selectionStart, selectionEnd); |
| 543 | 543 |
| 544 return text.isEmpty() || inputMethodController.hasComposition(); | 544 return text.isEmpty() || inputMethodController.hasComposition(); |
| 545 } | 545 } |
| 546 | 546 |
| 547 bool WebFrameWidgetImpl::confirmComposition() | 547 bool WebFrameWidgetImpl::confirmComposition(int newCursorPosition) |
| 548 { | 548 { |
| 549 return confirmComposition(DoNotKeepSelection); | 549 return confirmComposition(DoNotKeepSelection, newCursorPosition); |
| 550 } | 550 } |
| 551 | 551 |
| 552 bool WebFrameWidgetImpl::confirmComposition(ConfirmCompositionBehavior selection Behavior) | 552 bool WebFrameWidgetImpl::confirmComposition(ConfirmCompositionBehavior selection Behavior, int newCursorPosition) |
| 553 { | 553 { |
| 554 return confirmComposition(WebString(), selectionBehavior); | 554 return confirmComposition(WebString(), selectionBehavior, newCursorPosition) ; |
|
Changwan Ryu
2016/08/03 07:37:30
you can simply pass 1 here.
yabinh
2016/08/08 07:33:44
Done.
| |
| 555 } | 555 } |
| 556 | 556 |
| 557 bool WebFrameWidgetImpl::confirmComposition(const WebString& text) | 557 bool WebFrameWidgetImpl::confirmComposition(const WebString& text, int newCursor Position) |
| 558 { | 558 { |
| 559 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); | 559 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); |
| 560 return confirmComposition(text, DoNotKeepSelection); | 560 return confirmComposition(text, DoNotKeepSelection, newCursorPosition); |
| 561 } | 561 } |
| 562 | 562 |
| 563 bool WebFrameWidgetImpl::confirmComposition(const WebString& text, ConfirmCompos itionBehavior selectionBehavior) const | 563 bool WebFrameWidgetImpl::confirmComposition(const WebString& text, ConfirmCompos itionBehavior selectionBehavior, int newCursorPosition) const |
| 564 { | 564 { |
| 565 LocalFrame* focused = focusedLocalFrameAvailableForIme(); | 565 LocalFrame* focused = focusedLocalFrameAvailableForIme(); |
| 566 if (!focused) | 566 if (!focused) |
| 567 return false; | 567 return false; |
| 568 | 568 |
| 569 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) | 569 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) |
| 570 return plugin->confirmComposition(text, selectionBehavior); | 570 return plugin->confirmComposition(text, selectionBehavior, newCursorPosi tion); |
| 571 | 571 |
| 572 return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : Inp utMethodController::DoNotKeepSelection); | 572 return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : Inp utMethodController::DoNotKeepSelection, newCursorPosition); |
| 573 } | 573 } |
| 574 | 574 |
| 575 bool WebFrameWidgetImpl::compositionRange(size_t* location, size_t* length) | 575 bool WebFrameWidgetImpl::compositionRange(size_t* location, size_t* length) |
| 576 { | 576 { |
| 577 LocalFrame* focused = focusedLocalFrameAvailableForIme(); | 577 LocalFrame* focused = focusedLocalFrameAvailableForIme(); |
| 578 if (!focused) | 578 if (!focused) |
| 579 return false; | 579 return false; |
| 580 | 580 |
| 581 const EphemeralRange range = focused->inputMethodController().compositionEph emeralRange(); | 581 const EphemeralRange range = focused->inputMethodController().compositionEph emeralRange(); |
| 582 if (range.isNull()) | 582 if (range.isNull()) |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const | 1463 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const |
| 1464 { | 1464 { |
| 1465 if (!m_imeAcceptEvents) | 1465 if (!m_imeAcceptEvents) |
| 1466 return nullptr; | 1466 return nullptr; |
| 1467 return focusedLocalFrameInWidget(); | 1467 return focusedLocalFrameInWidget(); |
| 1468 } | 1468 } |
| 1469 | 1469 |
| 1470 } // namespace blink | 1470 } // namespace blink |
| OLD | NEW |