Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1119 ui::Range range(ui::Range::InvalidRange()); | 1119 ui::Range range(ui::Range::InvalidRange()); |
| 1120 size_t location, length; | 1120 size_t location, length; |
| 1121 if (webwidget_->caretOrSelectionRange(&location, &length)) { | 1121 if (webwidget_->caretOrSelectionRange(&location, &length)) { |
| 1122 range.set_start(location); | 1122 range.set_start(location); |
| 1123 range.set_end(location + length); | 1123 range.set_end(location + length); |
| 1124 } | 1124 } |
| 1125 Send(new ViewHostMsg_ImeCompositionRangeChanged(routing_id(), range)); | 1125 Send(new ViewHostMsg_ImeCompositionRangeChanged(routing_id(), range)); |
| 1126 } | 1126 } |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 void RenderWidget::OnImeConfirmComposition(const string16& text) { | 1129 void RenderWidget::OnImeConfirmComposition( |
| 1130 if (webwidget_) | 1130 const string16& text, const ui::Range& replacement_range) { |
| 1131 if (webwidget_) { | |
| 1132 // TODO(thakis): Uncomment this once | |
| 1133 // https://bugs.webkit.org/show_bug.cgi?id=69846 has landed. | |
|
jamesr
2011/10/12 00:34:51
A better way to do this is to guard this code with
| |
| 1134 // if (replacement_range.IsValid()) { | |
| 1135 // webwidget_->setSelectionOnFocusedFrame(replacement_range.start(), | |
| 1136 // replacement_range.end()); | |
| 1137 // } | |
| 1131 webwidget_->confirmComposition(text); | 1138 webwidget_->confirmComposition(text); |
| 1139 } | |
| 1132 // Send an updated IME range with just the caret range. | 1140 // Send an updated IME range with just the caret range. |
| 1133 ui::Range range(ui::Range::InvalidRange()); | 1141 ui::Range range(ui::Range::InvalidRange()); |
| 1134 size_t location, length; | 1142 size_t location, length; |
| 1135 if (webwidget_->caretOrSelectionRange(&location, &length)) { | 1143 if (webwidget_->caretOrSelectionRange(&location, &length)) { |
| 1136 range.set_start(location); | 1144 range.set_start(location); |
| 1137 range.set_end(location + length); | 1145 range.set_end(location + length); |
| 1138 } | 1146 } |
| 1139 Send(new ViewHostMsg_ImeCompositionRangeChanged(routing_id(), range)); | 1147 Send(new ViewHostMsg_ImeCompositionRangeChanged(routing_id(), range)); |
| 1140 } | 1148 } |
| 1141 | 1149 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1400 } | 1408 } |
| 1401 } | 1409 } |
| 1402 | 1410 |
| 1403 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1411 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
| 1404 return false; | 1412 return false; |
| 1405 } | 1413 } |
| 1406 | 1414 |
| 1407 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1415 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
| 1408 return false; | 1416 return false; |
| 1409 } | 1417 } |
| OLD | NEW |