| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. | 2 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return 0; | 206 return 0; |
| 207 } | 207 } |
| 208 | 208 |
| 209 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon
tData*>* /* fallbackFonts */, GlyphOverflow* glyphOverflow) const | 209 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon
tData*>* /* fallbackFonts */, GlyphOverflow* glyphOverflow) const |
| 210 { | 210 { |
| 211 HarfBuzzShaper shaper(this, run); | 211 HarfBuzzShaper shaper(this, run); |
| 212 if (!shaper.shape()) | 212 if (!shaper.shape()) |
| 213 return 0; | 213 return 0; |
| 214 | 214 |
| 215 if (glyphOverflow) { | 215 if (glyphOverflow) { |
| 216 glyphOverflow->top = std::max<int>(glyphOverflow->top, ceilf(-shaper.min
GlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().ascent(
))); | 216 glyphOverflow->top = std::max<int>(glyphOverflow->top, ceilf(-shaper.gly
phBoundingBox().top()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().ascen
t())); |
| 217 glyphOverflow->bottom = std::max<int>(glyphOverflow->bottom, ceilf(shape
r.maxGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().de
scent())); | 217 glyphOverflow->bottom = std::max<int>(glyphOverflow->bottom, ceilf(shape
r.glyphBoundingBox().bottom()) - (glyphOverflow->computeBounds ? 0 : fontMetrics
().descent())); |
| 218 glyphOverflow->left = std::max<int>(0, ceilf(-shaper.minGlyphBoundingBox
X())); | 218 glyphOverflow->left = std::max<int>(0, ceilf(-shaper.glyphBoundingBox().
left())); |
| 219 glyphOverflow->right = std::max<int>(0, ceilf(shaper.maxGlyphBoundingBox
X() - shaper.totalWidth())); | 219 glyphOverflow->right = std::max<int>(0, ceilf(shaper.glyphBoundingBox().
right() - shaper.totalWidth())); |
| 220 } | 220 } |
| 221 return shaper.totalWidth(); | 221 return shaper.totalWidth(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 // Return the code point index for the given |x| offset into the text run. | 224 // Return the code point index for the given |x| offset into the text run. |
| 225 int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, | 225 int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, |
| 226 bool includePartialGlyphs) const | 226 bool includePartialGlyphs) const |
| 227 { | 227 { |
| 228 HarfBuzzShaper shaper(this, run); | 228 HarfBuzzShaper shaper(this, run); |
| 229 if (!shaper.shape()) | 229 if (!shaper.shape()) |
| 230 return 0; | 230 return 0; |
| 231 return shaper.offsetForPosition(xFloat); | 231 return shaper.offsetForPosition(xFloat); |
| 232 } | 232 } |
| 233 | 233 |
| 234 // Return the rectangle for selecting the given range of code-points in the Text
Run. | 234 // Return the rectangle for selecting the given range of code-points in the Text
Run. |
| 235 FloatRect Font::selectionRectForComplexText(const TextRun& run, | 235 FloatRect Font::selectionRectForComplexText(const TextRun& run, |
| 236 const FloatPoint& point, int height, | 236 const FloatPoint& point, int height, |
| 237 int from, int to) const | 237 int from, int to) const |
| 238 { | 238 { |
| 239 HarfBuzzShaper shaper(this, run); | 239 HarfBuzzShaper shaper(this, run); |
| 240 if (!shaper.shape()) | 240 if (!shaper.shape()) |
| 241 return FloatRect(); | 241 return FloatRect(); |
| 242 return shaper.selectionRect(point, height, from, to); | 242 return shaper.selectionRect(point, height, from, to); |
| 243 } | 243 } |
| 244 | 244 |
| 245 } // namespace WebCore | 245 } // namespace WebCore |
| OLD | NEW |