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

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

Issue 1773403002: Update SVG text layout to use shaped glyph data & go fast (O(n^2)->O(n)) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1773353003
Patch Set: Fix TestExpectations collision Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp
index 92023e33591e1926460f8761450a772b7a6ad494..0945502746cfb37a993c7002f66fa4ccaf37a2e5 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp
@@ -116,4 +116,20 @@ CharacterRange CachingWordShaper::getCharacterRange(const Font* font,
return buffer.getCharacterRange(run.direction(), totalWidth, from, to);
}
+Vector<CharacterRange> CachingWordShaper::individualCharacterRanges(
+ const Font* font, const TextRun& run, unsigned from, unsigned to)
+{
+ ShapeResultBuffer buffer;
+ float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr,
+ &buffer);
+
+ Vector<CharacterRange> allExtents;
+ for (unsigned position = from; position <= to; position++) {
+ allExtents.append(buffer.getCharacterRange(run.direction(), totalWidth,
+ position, position + 1));
+ }
+
+ return allExtents;
+}
+
}; // namespace blink

Powered by Google App Engine
This is Rietveld 408576698