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

Side by Side Diff: content/renderer/render_widget.cc

Issue 2568093003: Support parsing BackgroundSpans and UnderlineSpans in Android IME's commitText() (Closed)
Patch Set: Don't try to add default underline for commitText(), attempt to fix Mac builds Created 4 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 text, WebVector<WebCompositionUnderline>(underlines), selection_start, 1523 text, WebVector<WebCompositionUnderline>(underlines), selection_start,
1524 selection_end)) { 1524 selection_end)) {
1525 // If we failed to set the composition text, then we need to let the browser 1525 // If we failed to set the composition text, then we need to let the browser
1526 // process to cancel the input method's ongoing composition session, to make 1526 // process to cancel the input method's ongoing composition session, to make
1527 // sure we are in a consistent state. 1527 // sure we are in a consistent state.
1528 Send(new InputHostMsg_ImeCancelComposition(routing_id())); 1528 Send(new InputHostMsg_ImeCancelComposition(routing_id()));
1529 } 1529 }
1530 UpdateCompositionInfo(false /* not an immediate request */); 1530 UpdateCompositionInfo(false /* not an immediate request */);
1531 } 1531 }
1532 1532
1533 void RenderWidget::OnImeCommitText(const base::string16& text, 1533 void RenderWidget::OnImeCommitText(
1534 const gfx::Range& replacement_range, 1534 const base::string16& text,
1535 int relative_cursor_pos) { 1535 const std::vector<WebCompositionUnderline>& underlines,
1536 const gfx::Range& replacement_range,
1537 int relative_cursor_pos) {
1536 #if BUILDFLAG(ENABLE_PLUGINS) 1538 #if BUILDFLAG(ENABLE_PLUGINS)
1537 if (focused_pepper_plugin_) { 1539 if (focused_pepper_plugin_) {
1538 focused_pepper_plugin_->render_frame()->OnImeCommitText( 1540 focused_pepper_plugin_->render_frame()->OnImeCommitText(
1539 text, replacement_range, relative_cursor_pos); 1541 text, replacement_range, relative_cursor_pos);
1540 return; 1542 return;
1541 } 1543 }
1542 #endif 1544 #endif
1543 if (replacement_range.IsValid()) { 1545 if (replacement_range.IsValid()) {
1544 GetWebWidget()->applyReplacementRange( 1546 GetWebWidget()->applyReplacementRange(
1545 WebRange(replacement_range.start(), replacement_range.length())); 1547 WebRange(replacement_range.start(), replacement_range.length()));
1546 } 1548 }
1547 1549
1548 if (!GetWebWidget()) 1550 if (!GetWebWidget())
1549 return; 1551 return;
1550 ImeEventGuard guard(this); 1552 ImeEventGuard guard(this);
1551 input_handler_->set_handling_input_event(true); 1553 input_handler_->set_handling_input_event(true);
1552 if (auto* controller = GetInputMethodController()) 1554 if (auto* controller = GetInputMethodController())
1553 controller->commitText(text, relative_cursor_pos); 1555 controller->commitText(text, WebVector<WebCompositionUnderline>(underlines),
dcheng 2016/12/15 10:13:17 I think the explicit call to WebVector is usually
1556 relative_cursor_pos);
1554 input_handler_->set_handling_input_event(false); 1557 input_handler_->set_handling_input_event(false);
1555 UpdateCompositionInfo(false /* not an immediate request */); 1558 UpdateCompositionInfo(false /* not an immediate request */);
1556 } 1559 }
1557 1560
1558 void RenderWidget::OnImeFinishComposingText(bool keep_selection) { 1561 void RenderWidget::OnImeFinishComposingText(bool keep_selection) {
1559 #if BUILDFLAG(ENABLE_PLUGINS) 1562 #if BUILDFLAG(ENABLE_PLUGINS)
1560 if (focused_pepper_plugin_) { 1563 if (focused_pepper_plugin_) {
1561 focused_pepper_plugin_->render_frame()->OnImeFinishComposingText( 1564 focused_pepper_plugin_->render_frame()->OnImeFinishComposingText(
1562 keep_selection); 1565 keep_selection);
1563 return; 1566 return;
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 // browser side (https://crbug.com/669219). 2243 // browser side (https://crbug.com/669219).
2241 // If there is no WebFrameWidget, then there will be no 2244 // If there is no WebFrameWidget, then there will be no
2242 // InputMethodControllers for a WebLocalFrame. 2245 // InputMethodControllers for a WebLocalFrame.
2243 return nullptr; 2246 return nullptr;
2244 } 2247 }
2245 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) 2248 return static_cast<blink::WebFrameWidget*>(GetWebWidget())
2246 ->getActiveWebInputMethodController(); 2249 ->getActiveWebInputMethodController();
2247 } 2250 }
2248 2251
2249 } // namespace content 2252 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | third_party/WebKit/Source/core/editing/InputMethodController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698