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

Side by Side Diff: Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp

Issue 205553003: Invalidation not taking glyph bounds into account on HarfBuzz path (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 float Font::getGlyphsAndAdvancesForComplexText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const 201 float Font::getGlyphsAndAdvancesForComplexText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
202 { 202 {
203 HarfBuzzShaper shaper(this, run, HarfBuzzShaper::ForTextEmphasis); 203 HarfBuzzShaper shaper(this, run, HarfBuzzShaper::ForTextEmphasis);
204 shaper.setDrawRange(from, to); 204 shaper.setDrawRange(from, to);
205 shaper.shape(&glyphBuffer); 205 shaper.shape(&glyphBuffer);
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
215 if (glyphOverflow) {
216 glyphOverflow->top = std::max<int>(glyphOverflow->top, ceilf(-shaper.min GlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().ascent( )));
217 glyphOverflow->bottom = std::max<int>(glyphOverflow->bottom, ceilf(shape r.maxGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().de scent()));
218 glyphOverflow->left = std::max<int>(0, ceilf(-shaper.minGlyphBoundingBox X()));
219 glyphOverflow->right = std::max<int>(0, ceilf(shaper.maxGlyphBoundingBox X() - shaper.totalWidth()));
220 }
214 return shaper.totalWidth(); 221 return shaper.totalWidth();
215 } 222 }
216 223
217 // 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.
218 int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, 225 int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat,
219 bool includePartialGlyphs) const 226 bool includePartialGlyphs) const
220 { 227 {
221 HarfBuzzShaper shaper(this, run); 228 HarfBuzzShaper shaper(this, run);
222 if (!shaper.shape()) 229 if (!shaper.shape())
223 return 0; 230 return 0;
224 return shaper.offsetForPosition(xFloat); 231 return shaper.offsetForPosition(xFloat);
225 } 232 }
226 233
227 // 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.
228 FloatRect Font::selectionRectForComplexText(const TextRun& run, 235 FloatRect Font::selectionRectForComplexText(const TextRun& run,
229 const FloatPoint& point, int height, 236 const FloatPoint& point, int height,
230 int from, int to) const 237 int from, int to) const
231 { 238 {
232 HarfBuzzShaper shaper(this, run); 239 HarfBuzzShaper shaper(this, run);
233 if (!shaper.shape()) 240 if (!shaper.shape())
234 return FloatRect(); 241 return FloatRect();
235 return shaper.selectionRect(point, height, from, to); 242 return shaper.selectionRect(point, height, from, to);
236 } 243 }
237 244
238 } // namespace WebCore 245 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698