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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp

Issue 1966703002: Support includePartialGlyphs=false in Font::offsetForPositionForComplexText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment as per eae review Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 if (wordResult) { 71 if (wordResult) {
72 totalWidth += wordResult->width(); 72 totalWidth += wordResult->width();
73 if (fallbackFonts) 73 if (fallbackFonts)
74 wordResult->fallbackFonts(fallbackFonts); 74 wordResult->fallbackFonts(fallbackFonts);
75 resultsBuffer->appendResult(wordResult.release()); 75 resultsBuffer->appendResult(wordResult.release());
76 } 76 }
77 } 77 }
78 return totalWidth; 78 return totalWidth;
79 } 79 }
80 80
81 int CachingWordShaper::offsetForPosition(const Font* font, const TextRun& run, f loat targetX) 81 int CachingWordShaper::offsetForPosition(const Font* font, const TextRun& run, f loat targetX, bool includePartialGlyphs)
82 { 82 {
83 ShapeResultBuffer buffer; 83 ShapeResultBuffer buffer;
84 shapeResultsForRun(m_shapeCache, font, run, nullptr, &buffer); 84 shapeResultsForRun(m_shapeCache, font, run, nullptr, &buffer);
85 85
86 return buffer.offsetForPosition(run, targetX); 86 return buffer.offsetForPosition(run, targetX, includePartialGlyphs);
87 } 87 }
88 88
89 float CachingWordShaper::fillGlyphBuffer(const Font* font, const TextRun& run, 89 float CachingWordShaper::fillGlyphBuffer(const Font* font, const TextRun& run,
90 HashSet<const SimpleFontData*>* fallbackFonts, 90 HashSet<const SimpleFontData*>* fallbackFonts,
91 GlyphBuffer* glyphBuffer, unsigned from, unsigned to) 91 GlyphBuffer* glyphBuffer, unsigned from, unsigned to)
92 { 92 {
93 ShapeResultBuffer buffer; 93 ShapeResultBuffer buffer;
94 shapeResultsForRun(m_shapeCache, font, run, fallbackFonts, &buffer); 94 shapeResultsForRun(m_shapeCache, font, run, fallbackFonts, &buffer);
95 95
96 return buffer.fillGlyphBuffer(glyphBuffer, run, from, to); 96 return buffer.fillGlyphBuffer(glyphBuffer, run, from, to);
(...skipping 23 matching lines...) Expand all
120 const Font* font, const TextRun& run) 120 const Font* font, const TextRun& run)
121 { 121 {
122 ShapeResultBuffer buffer; 122 ShapeResultBuffer buffer;
123 float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr, 123 float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr,
124 &buffer); 124 &buffer);
125 125
126 return buffer.individualCharacterRanges(run.direction(), totalWidth); 126 return buffer.individualCharacterRanges(run.direction(), totalWidth);
127 } 127 }
128 128
129 }; // namespace blink 129 }; // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698