| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/glue/plugins/pepper_font.h" | 5 #include "webkit/glue/plugins/pepper_font.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "ppapi/c/dev/ppb_font_dev.h" | 9 #include "ppapi/c/dev/ppb_font_dev.h" |
| 10 #include "ppapi/c/pp_rect.h" | 10 #include "ppapi/c/pp_rect.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 Font::~Font() { | 194 Font::~Font() { |
| 195 } | 195 } |
| 196 | 196 |
| 197 // static | 197 // static |
| 198 const PPB_Font_Dev* Font::GetInterface() { | 198 const PPB_Font_Dev* Font::GetInterface() { |
| 199 return &ppb_font; | 199 return &ppb_font; |
| 200 } | 200 } |
| 201 | 201 |
| 202 Font* Font::AsFont() { |
| 203 return this; |
| 204 } |
| 205 |
| 202 bool Font::Describe(PP_FontDescription_Dev* description, | 206 bool Font::Describe(PP_FontDescription_Dev* description, |
| 203 PP_FontMetrics_Dev* metrics) { | 207 PP_FontMetrics_Dev* metrics) { |
| 204 if (description->face.type != PP_VARTYPE_UNDEFINED) | 208 if (description->face.type != PP_VARTYPE_UNDEFINED) |
| 205 return false; | 209 return false; |
| 206 | 210 |
| 207 WebFontDescription web_desc = font_->fontDescription(); | 211 WebFontDescription web_desc = font_->fontDescription(); |
| 208 | 212 |
| 209 // While converting the other way in PPFontDescToWebFontDesc we validated | 213 // While converting the other way in PPFontDescToWebFontDesc we validated |
| 210 // that the enums can be casted. | 214 // that the enums can be casted. |
| 211 description->face = StringVar::StringToPPVar(module(), | 215 description->face = StringVar::StringToPPVar(module(), |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 return -1; | 289 return -1; |
| 286 if (char_offset >= run.text.length()) | 290 if (char_offset >= run.text.length()) |
| 287 return -1; | 291 return -1; |
| 288 | 292 |
| 289 WebFloatRect rect = font_->selectionRectForText( | 293 WebFloatRect rect = font_->selectionRectForText( |
| 290 run, WebFloatPoint(0.0f, 0.0f), font_->height(), 0, char_offset); | 294 run, WebFloatPoint(0.0f, 0.0f), font_->height(), 0, char_offset); |
| 291 return static_cast<int>(rect.width); | 295 return static_cast<int>(rect.width); |
| 292 } | 296 } |
| 293 | 297 |
| 294 } // namespace pepper | 298 } // namespace pepper |
| OLD | NEW |