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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 8499348116f1f071758b2f6f572737449e74f545..020ef239c6115d68539a8dee8111fb249120b734 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1280,17 +1280,18 @@ void RenderWidgetHostViewAura::SetCompositionText(
if (!host_)
return;
- // ui::CompositionUnderline should be identical to
- // blink::WebCompositionUnderline, so that we can do reinterpret_cast safely.
- COMPILE_ASSERT(sizeof(ui::CompositionUnderline) ==
- sizeof(blink::WebCompositionUnderline),
- ui_CompositionUnderline__WebKit_WebCompositionUnderline_diff);
-
// TODO(suzhe): convert both renderer_host and renderer to use
// ui::CompositionText.
- const std::vector<blink::WebCompositionUnderline>& underlines =
- reinterpret_cast<const std::vector<blink::WebCompositionUnderline>&>(
- composition.underlines);
+ std::vector<blink::WebCompositionUnderline> underlines;
+ underlines.reserve(composition.underlines.size());
+ for (std::vector<ui::CompositionUnderline>::const_iterator it =
+ composition.underlines.begin();
+ it != composition.underlines.end(); ++it) {
+ underlines.push_back(blink::WebCompositionUnderline(it->start_offset,
+ it->end_offset,
+ it->color,
+ it->thick));
+ }
// TODO(suzhe): due to a bug of webkit, we can't use selection range with
// composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788
« 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