Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1208)

Unified Diff: Source/platform/fonts/Font.cpp

Issue 820093005: [TextBlob] Recompute blob bounds when empty. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/Font.cpp
diff --git a/Source/platform/fonts/Font.cpp b/Source/platform/fonts/Font.cpp
index da2d97d73f3d537852b1944d48a89215ad415429..e468bfd0472d61195dfbffcb59f969a3756e7d1f 100644
--- a/Source/platform/fonts/Font.cpp
+++ b/Source/platform/fonts/Font.cpp
@@ -256,8 +256,12 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
return result;
}
-static bool requiresRecomputingBounds(const Font& font)
+static bool requiresRecomputingBounds(const Font& font, const FloatRect& bounds)
{
+ // Blobs should never have empty bounds, but see http://crbug.com/445527
+ if (bounds.isEmpty())
+ return true;
+
const FontDescription& fontDescription = font.fontDescription();
return fontDescription.letterSpacing() < 0 || fontDescription.wordSpacing() < 0;
}
@@ -271,7 +275,7 @@ PassTextBlobPtr Font::buildTextBlob(const GlyphBuffer& glyphBuffer, const FloatR
SkRect skBounds = bounds;
// FIXME: Identify these cases earlier on and avoid using bounds that are
// not visually correct in other places.
- const SkRect* skBoundsPtr = requiresRecomputingBounds(*this) ? nullptr : &skBounds;
+ const SkRect* skBoundsPtr = requiresRecomputingBounds(*this, bounds) ? nullptr : &skBounds;
bool hasVerticalOffsets = glyphBuffer.hasVerticalOffsets();
unsigned i = 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698