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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) { | 249 if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) { |
250 cacheEntry->glyphBounds = glyphBounds; | 250 cacheEntry->glyphBounds = glyphBounds; |
251 cacheEntry->width = result; | 251 cacheEntry->width = result; |
252 } | 252 } |
253 | 253 |
254 if (glyphOverflow) | 254 if (glyphOverflow) |
255 updateGlyphOverflowFromBounds(glyphBounds, fontMetrics(), glyphOverflow)
; | 255 updateGlyphOverflowFromBounds(glyphBounds, fontMetrics(), glyphOverflow)
; |
256 return result; | 256 return result; |
257 } | 257 } |
258 | 258 |
259 static bool requiresRecomputingBounds(const Font& font) | 259 static bool requiresRecomputingBounds(const Font& font, const FloatRect& bounds) |
260 { | 260 { |
| 261 // Blobs should never have empty bounds, but see http://crbug.com/445527 |
| 262 if (bounds.isEmpty()) |
| 263 return true; |
| 264 |
261 const FontDescription& fontDescription = font.fontDescription(); | 265 const FontDescription& fontDescription = font.fontDescription(); |
262 return fontDescription.letterSpacing() < 0 || fontDescription.wordSpacing()
< 0; | 266 return fontDescription.letterSpacing() < 0 || fontDescription.wordSpacing()
< 0; |
263 } | 267 } |
264 | 268 |
265 PassTextBlobPtr Font::buildTextBlob(const GlyphBuffer& glyphBuffer, const FloatR
ect& bounds, | 269 PassTextBlobPtr Font::buildTextBlob(const GlyphBuffer& glyphBuffer, const FloatR
ect& bounds, |
266 bool couldUseLCD) const | 270 bool couldUseLCD) const |
267 { | 271 { |
268 ASSERT(RuntimeEnabledFeatures::textBlobEnabled()); | 272 ASSERT(RuntimeEnabledFeatures::textBlobEnabled()); |
269 | 273 |
270 SkTextBlobBuilder builder; | 274 SkTextBlobBuilder builder; |
271 SkRect skBounds = bounds; | 275 SkRect skBounds = bounds; |
272 // FIXME: Identify these cases earlier on and avoid using bounds that are | 276 // FIXME: Identify these cases earlier on and avoid using bounds that are |
273 // not visually correct in other places. | 277 // not visually correct in other places. |
274 const SkRect* skBoundsPtr = requiresRecomputingBounds(*this) ? nullptr : &sk
Bounds; | 278 const SkRect* skBoundsPtr = requiresRecomputingBounds(*this, bounds) ? nullp
tr : &skBounds; |
275 bool hasVerticalOffsets = glyphBuffer.hasVerticalOffsets(); | 279 bool hasVerticalOffsets = glyphBuffer.hasVerticalOffsets(); |
276 | 280 |
277 unsigned i = 0; | 281 unsigned i = 0; |
278 while (i < glyphBuffer.size()) { | 282 while (i < glyphBuffer.size()) { |
279 const SimpleFontData* fontData = glyphBuffer.fontDataAt(i); | 283 const SimpleFontData* fontData = glyphBuffer.fontDataAt(i); |
280 | 284 |
281 // FIXME: Handle vertical text. | 285 // FIXME: Handle vertical text. |
282 if (fontData->platformData().orientation() == Vertical) | 286 if (fontData->platformData().orientation() == Vertical) |
283 return nullptr; | 287 return nullptr; |
284 | 288 |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 if (delta <= 0) | 964 if (delta <= 0) |
961 break; | 965 break; |
962 } | 966 } |
963 } | 967 } |
964 } | 968 } |
965 | 969 |
966 return offset; | 970 return offset; |
967 } | 971 } |
968 | 972 |
969 } // namespace blink | 973 } // namespace blink |
OLD | NEW |