| OLD | NEW |
| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 if (wordResult) { | 79 if (wordResult) { |
| 80 results->append(wordResult); | 80 results->append(wordResult); |
| 81 totalWidth += wordResult->width(); | 81 totalWidth += wordResult->width(); |
| 82 if (fallbackFonts) | 82 if (fallbackFonts) |
| 83 wordResult->fallbackFonts(fallbackFonts); | 83 wordResult->fallbackFonts(fallbackFonts); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 return totalWidth; | 86 return totalWidth; |
| 87 } | 87 } |
| 88 | 88 |
| 89 int CachingWordShaper::offsetForPosition(const Font* font, const TextRun& run, f
loat targetX) |
| 90 { |
| 91 Vector<RefPtr<ShapeResult>> results; |
| 92 shapeResultsForRun(m_shapeCache.get(), font, run, nullptr, &results); |
| 93 |
| 94 return ShapeResult::offsetForPosition(results, run, targetX); |
| 95 } |
| 96 |
| 89 float CachingWordShaper::fillGlyphBuffer(const Font* font, const TextRun& run, | 97 float CachingWordShaper::fillGlyphBuffer(const Font* font, const TextRun& run, |
| 90 HashSet<const SimpleFontData*>* fallbackFonts, | 98 HashSet<const SimpleFontData*>* fallbackFonts, |
| 91 GlyphBuffer* glyphBuffer, unsigned from, unsigned to) | 99 GlyphBuffer* glyphBuffer, unsigned from, unsigned to) |
| 92 { | 100 { |
| 93 Vector<RefPtr<ShapeResult>> results; | 101 Vector<RefPtr<ShapeResult>> results; |
| 94 shapeResultsForRun(m_shapeCache.get(), font, run, fallbackFonts, &results); | 102 shapeResultsForRun(m_shapeCache.get(), font, run, fallbackFonts, &results); |
| 95 | 103 |
| 96 return ShapeResult::fillGlyphBuffer(results, glyphBuffer, run, from, to); | 104 return ShapeResult::fillGlyphBuffer(results, glyphBuffer, run, from, to); |
| 97 } | 105 } |
| 98 | 106 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 112 { | 120 { |
| 113 Vector<RefPtr<ShapeResult>> results; | 121 Vector<RefPtr<ShapeResult>> results; |
| 114 float totalWidth = shapeResultsForRun(m_shapeCache.get(), font, run, nullptr
, | 122 float totalWidth = shapeResultsForRun(m_shapeCache.get(), font, run, nullptr
, |
| 115 &results); | 123 &results); |
| 116 | 124 |
| 117 return ShapeResult::selectionRect(results, run.direction(), totalWidth, | 125 return ShapeResult::selectionRect(results, run.direction(), totalWidth, |
| 118 point, height, from, to); | 126 point, height, from, to); |
| 119 } | 127 } |
| 120 | 128 |
| 121 }; // namespace blink | 129 }; // namespace blink |
| OLD | NEW |