OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. |
6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. | 6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) { | 171 if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) { |
172 cacheEntry->glyphBounds = glyphBounds; | 172 cacheEntry->glyphBounds = glyphBounds; |
173 cacheEntry->width = result; | 173 cacheEntry->width = result; |
174 } | 174 } |
175 | 175 |
176 if (glyphOverflow) | 176 if (glyphOverflow) |
177 updateGlyphOverflowFromBounds(glyphBounds, fontMetrics(), glyphOverflow)
; | 177 updateGlyphOverflowFromBounds(glyphBounds, fontMetrics(), glyphOverflow)
; |
178 return result; | 178 return result; |
179 } | 179 } |
180 | 180 |
181 float Font::width(const TextRun& run, unsigned& charsConsumed, Glyph& glyphId) c
onst | 181 float Font::width(const TextRun& run, int& charsConsumed, Glyph& glyphId) const |
182 { | 182 { |
183 #if ENABLE(SVG_FONTS) | 183 #if ENABLE(SVG_FONTS) |
184 if (TextRun::RenderingContext* renderingContext = run.renderingContext()) | 184 if (TextRun::RenderingContext* renderingContext = run.renderingContext()) |
185 return renderingContext->floatWidthUsingSVGFont(*this, run, charsConsume
d, glyphId); | 185 return renderingContext->floatWidthUsingSVGFont(*this, run, charsConsume
d, glyphId); |
186 #endif | 186 #endif |
187 | 187 |
188 charsConsumed = run.length(); | 188 charsConsumed = run.length(); |
189 glyphId = 0; | 189 glyphId = 0; |
190 return width(run); | 190 return width(run); |
191 } | 191 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 } | 272 } |
273 | 273 |
274 advance = x; | 274 advance = x; |
275 return adoptRef(builder.build()); | 275 return adoptRef(builder.build()); |
276 } | 276 } |
277 | 277 |
278 | 278 |
279 FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point
, int h, int from, int to, bool accountForGlyphBounds) const | 279 FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point
, int h, int from, int to, bool accountForGlyphBounds) const |
280 { | 280 { |
281 to = (to == -1 ? run.length() : to); | 281 to = (to == -1 ? run.length() : to); |
282 ASSERT(from >= 0); | |
283 ASSERT(to >= 0); | |
284 | 282 |
285 TextRunPaintInfo runInfo(run); | 283 TextRunPaintInfo runInfo(run); |
286 runInfo.from = from; | 284 runInfo.from = from; |
287 runInfo.to = to; | 285 runInfo.to = to; |
288 | 286 |
289 if (codePath(runInfo) != ComplexPath) | 287 if (codePath(runInfo) != ComplexPath) |
290 return selectionRectForSimpleText(run, point, h, from, to, accountForGly
phBounds); | 288 return selectionRectForSimpleText(run, point, h, from, to, accountForGly
phBounds); |
291 | 289 |
292 return selectionRectForComplexText(run, point, h, from, to); | 290 return selectionRectForComplexText(run, point, h, from, to); |
293 } | 291 } |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 if (delta <= 0) | 1155 if (delta <= 0) |
1158 break; | 1156 break; |
1159 } | 1157 } |
1160 } | 1158 } |
1161 } | 1159 } |
1162 | 1160 |
1163 return offset; | 1161 return offset; |
1164 } | 1162 } |
1165 | 1163 |
1166 } // namespace blink | 1164 } // namespace blink |
OLD | NEW |