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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 319553002: Removing reinterpret_cast<std::vector<...> > in RenderWidgetHostViewAura::SetCompositionText(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | 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/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 host_->LostMouseLock(); 1273 host_->LostMouseLock();
1274 } 1274 }
1275 1275
1276 //////////////////////////////////////////////////////////////////////////////// 1276 ////////////////////////////////////////////////////////////////////////////////
1277 // RenderWidgetHostViewAura, ui::TextInputClient implementation: 1277 // RenderWidgetHostViewAura, ui::TextInputClient implementation:
1278 void RenderWidgetHostViewAura::SetCompositionText( 1278 void RenderWidgetHostViewAura::SetCompositionText(
1279 const ui::CompositionText& composition) { 1279 const ui::CompositionText& composition) {
1280 if (!host_) 1280 if (!host_)
1281 return; 1281 return;
1282 1282
1283 // ui::CompositionUnderline should be identical to
1284 // blink::WebCompositionUnderline, so that we can do reinterpret_cast safely.
1285 COMPILE_ASSERT(sizeof(ui::CompositionUnderline) ==
1286 sizeof(blink::WebCompositionUnderline),
1287 ui_CompositionUnderline__WebKit_WebCompositionUnderline_diff);
1288
1289 // TODO(suzhe): convert both renderer_host and renderer to use 1283 // TODO(suzhe): convert both renderer_host and renderer to use
1290 // ui::CompositionText. 1284 // ui::CompositionText.
1291 const std::vector<blink::WebCompositionUnderline>& underlines = 1285 std::vector<blink::WebCompositionUnderline> underlines;
1292 reinterpret_cast<const std::vector<blink::WebCompositionUnderline>&>( 1286 underlines.reserve(composition.underlines.size());
1293 composition.underlines); 1287 for (std::vector<ui::CompositionUnderline>::const_iterator it =
1288 composition.underlines.begin();
1289 it != composition.underlines.end(); ++it) {
1290 underlines.push_back(blink::WebCompositionUnderline(it->start_offset,
1291 it->end_offset,
1292 it->color,
1293 it->thick));
1294 }
1294 1295
1295 // TODO(suzhe): due to a bug of webkit, we can't use selection range with 1296 // TODO(suzhe): due to a bug of webkit, we can't use selection range with
1296 // composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788 1297 // composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788
1297 host_->ImeSetComposition(composition.text, underlines, 1298 host_->ImeSetComposition(composition.text, underlines,
1298 composition.selection.end(), 1299 composition.selection.end(),
1299 composition.selection.end()); 1300 composition.selection.end());
1300 1301
1301 has_composition_text_ = !composition.text.empty(); 1302 has_composition_text_ = !composition.text.empty();
1302 } 1303 }
1303 1304
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
2375 2376
2376 //////////////////////////////////////////////////////////////////////////////// 2377 ////////////////////////////////////////////////////////////////////////////////
2377 // RenderWidgetHostViewBase, public: 2378 // RenderWidgetHostViewBase, public:
2378 2379
2379 // static 2380 // static
2380 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2381 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2381 GetScreenInfoForWindow(results, NULL); 2382 GetScreenInfoForWindow(results, NULL);
2382 } 2383 }
2383 2384
2384 } // namespace content 2385 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698