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

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

Issue 2568093003: Support parsing BackgroundSpans and UnderlineSpans in Android IME's commitText() (Closed)
Patch Set: Use addCompositionUnderlines() where I said I couldn't Created 3 years, 11 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 text, WebVector<WebCompositionUnderline>(underlines), selection_start, 1532 text, WebVector<WebCompositionUnderline>(underlines), selection_start,
1533 selection_end)) { 1533 selection_end)) {
1534 // If we failed to set the composition text, then we need to let the browser 1534 // If we failed to set the composition text, then we need to let the browser
1535 // process to cancel the input method's ongoing composition session, to make 1535 // process to cancel the input method's ongoing composition session, to make
1536 // sure we are in a consistent state. 1536 // sure we are in a consistent state.
1537 Send(new InputHostMsg_ImeCancelComposition(routing_id())); 1537 Send(new InputHostMsg_ImeCancelComposition(routing_id()));
1538 } 1538 }
1539 UpdateCompositionInfo(false /* not an immediate request */); 1539 UpdateCompositionInfo(false /* not an immediate request */);
1540 } 1540 }
1541 1541
1542 void RenderWidget::OnImeCommitText(const base::string16& text, 1542 void RenderWidget::OnImeCommitText(
1543 const gfx::Range& replacement_range, 1543 const base::string16& text,
1544 int relative_cursor_pos) { 1544 const std::vector<WebCompositionUnderline>& underlines,
1545 const gfx::Range& replacement_range,
1546 int relative_cursor_pos) {
1545 if (!ShouldHandleImeEvents()) 1547 if (!ShouldHandleImeEvents())
1546 return; 1548 return;
1547 1549
1548 #if BUILDFLAG(ENABLE_PLUGINS) 1550 #if BUILDFLAG(ENABLE_PLUGINS)
1549 if (focused_pepper_plugin_) { 1551 if (focused_pepper_plugin_) {
1550 focused_pepper_plugin_->render_frame()->OnImeCommitText( 1552 focused_pepper_plugin_->render_frame()->OnImeCommitText(
1551 text, replacement_range, relative_cursor_pos); 1553 text, replacement_range, relative_cursor_pos);
1552 return; 1554 return;
1553 } 1555 }
1554 #endif 1556 #endif
1555 if (replacement_range.IsValid()) { 1557 if (replacement_range.IsValid()) {
1556 GetWebWidget()->applyReplacementRange( 1558 GetWebWidget()->applyReplacementRange(
1557 WebRange(replacement_range.start(), replacement_range.length())); 1559 WebRange(replacement_range.start(), replacement_range.length()));
1558 } 1560 }
1559 1561
1560 if (!GetWebWidget()) 1562 if (!GetWebWidget())
1561 return; 1563 return;
1562 ImeEventGuard guard(this); 1564 ImeEventGuard guard(this);
1563 input_handler_->set_handling_input_event(true); 1565 input_handler_->set_handling_input_event(true);
1564 if (auto* controller = GetInputMethodController()) 1566 if (auto* controller = GetInputMethodController())
1565 controller->commitText(text, relative_cursor_pos); 1567 controller->commitText(text, WebVector<WebCompositionUnderline>(underlines),
1568 relative_cursor_pos);
1566 input_handler_->set_handling_input_event(false); 1569 input_handler_->set_handling_input_event(false);
1567 UpdateCompositionInfo(false /* not an immediate request */); 1570 UpdateCompositionInfo(false /* not an immediate request */);
1568 } 1571 }
1569 1572
1570 void RenderWidget::OnImeFinishComposingText(bool keep_selection) { 1573 void RenderWidget::OnImeFinishComposingText(bool keep_selection) {
1571 if (!ShouldHandleImeEvents()) 1574 if (!ShouldHandleImeEvents())
1572 return; 1575 return;
1573 1576
1574 #if BUILDFLAG(ENABLE_PLUGINS) 1577 #if BUILDFLAG(ENABLE_PLUGINS)
1575 if (focused_pepper_plugin_) { 1578 if (focused_pepper_plugin_) {
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 // browser side (https://crbug.com/669219). 2274 // browser side (https://crbug.com/669219).
2272 // If there is no WebFrameWidget, then there will be no 2275 // If there is no WebFrameWidget, then there will be no
2273 // InputMethodControllers for a WebLocalFrame. 2276 // InputMethodControllers for a WebLocalFrame.
2274 return nullptr; 2277 return nullptr;
2275 } 2278 }
2276 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) 2279 return static_cast<blink::WebFrameWidget*>(GetWebWidget())
2277 ->getActiveWebInputMethodController(); 2280 ->getActiveWebInputMethodController();
2278 } 2281 }
2279 2282
2280 } // namespace content 2283 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698