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 "ppapi/proxy/ppb_font_proxy.h" | 5 #include "ppapi/proxy/ppb_font_proxy.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_font_dev.h" | 7 #include "ppapi/c/dev/ppb_font_dev.h" |
8 #include "ppapi/proxy/plugin_dispatcher.h" | 8 #include "ppapi/proxy/plugin_dispatcher.h" |
9 #include "ppapi/proxy/plugin_resource.h" | 9 #include "ppapi/proxy/plugin_resource.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 in_description.SetToPPFontDescription(dispatcher(), &in_pp_desc, false); | 242 in_description.SetToPPFontDescription(dispatcher(), &in_pp_desc, false); |
243 | 243 |
244 // Make sure the output is always defined so we can still serialize it back | 244 // Make sure the output is always defined so we can still serialize it back |
245 // to the plugin below. | 245 // to the plugin below. |
246 PP_FontDescription_Dev out_pp_desc; | 246 PP_FontDescription_Dev out_pp_desc; |
247 memset(&out_pp_desc, 0, sizeof(PP_FontDescription_Dev)); | 247 memset(&out_pp_desc, 0, sizeof(PP_FontDescription_Dev)); |
248 out_pp_desc.face = PP_MakeUndefined(); | 248 out_pp_desc.face = PP_MakeUndefined(); |
249 | 249 |
250 result->SetHostResource(instance, | 250 result->SetHostResource(instance, |
251 ppb_font_target()->Create(instance, &in_pp_desc)); | 251 ppb_font_target()->Create(instance, &in_pp_desc)); |
252 if (result->is_null()) { | 252 if (!result->is_null()) { |
253 // Get the metrics and resulting description to return to the browser. | 253 // Get the metrics and resulting description to return to the browser. |
254 PP_FontMetrics_Dev metrics; | 254 PP_FontMetrics_Dev metrics; |
255 if (ppb_font_target()->Describe(result->host_resource(), &out_pp_desc, | 255 if (ppb_font_target()->Describe(result->host_resource(), &out_pp_desc, |
256 &metrics)) { | 256 &metrics)) { |
257 out_metrics->assign(reinterpret_cast<const char*>(&metrics), | 257 out_metrics->assign(reinterpret_cast<const char*>(&metrics), |
258 sizeof(PP_FontMetrics_Dev)); | 258 sizeof(PP_FontMetrics_Dev)); |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
262 // This must always get called or it will assert when trying to serialize | 262 // This must always get called or it will assert when trying to serialize |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 run.text = text.Get(dispatcher()); | 317 run.text = text.Get(dispatcher()); |
318 run.rtl = text_is_rtl; | 318 run.rtl = text_is_rtl; |
319 run.override_direction = override_direction; | 319 run.override_direction = override_direction; |
320 | 320 |
321 *result = ppb_font_target()->PixelOffsetForCharacter(font.host_resource(), | 321 *result = ppb_font_target()->PixelOffsetForCharacter(font.host_resource(), |
322 &run, char_offset); | 322 &run, char_offset); |
323 } | 323 } |
324 | 324 |
325 } // namespace proxy | 325 } // namespace proxy |
326 } // namespace pp | 326 } // namespace pp |
OLD | NEW |