Index: third_party/WebKit/Source/platform/fonts/Font.cpp |
diff --git a/third_party/WebKit/Source/platform/fonts/Font.cpp b/third_party/WebKit/Source/platform/fonts/Font.cpp |
index 271ed83045017fa02b64325d4b2f92c8b443bf4d..462e43864b0bde64426180e904fc788857f91270 100644 |
--- a/third_party/WebKit/Source/platform/fonts/Font.cpp |
+++ b/third_party/WebKit/Source/platform/fonts/Font.cpp |
@@ -407,6 +407,50 @@ void Font::drawGlyphBuffer(SkCanvas* canvas, |
} |
} |
+int Font::getTextIntercepts(SkCanvas*, |
+ const TextRunPaintInfo& runInfo, |
+ float deviceScaleFactor, |
+ const SkPaint& paint, |
+ const SkScalar* bounds, |
+ SkScalar* intervals) const { |
+ if (shouldSkipDrawing()) |
+ return false; |
f(malita)
2016/10/13 18:09:19
false -> 0?
drott
2016/10/14 15:15:34
Removed the return type.
|
+ |
+ if (runInfo.cachedTextBlob && runInfo.cachedTextBlob->get()) { |
+ return paint.getTextBlobIntercepts(runInfo.cachedTextBlob->get(), bounds, |
+ intervals); |
+ } |
+ |
+ GlyphBuffer glyphBuffer; |
+ buildGlyphBuffer(runInfo, glyphBuffer); |
+ |
+ GlyphBufferBloberizer bloberizer(glyphBuffer, this, deviceScaleFactor); |
+ std::pair<sk_sp<SkTextBlob>, BlobRotation> blob; |
+ |
+ int numIntervals = 0; |
+ while (!bloberizer.done()) { |
+ blob = bloberizer.next(); |
+ DCHECK(blob.first); |
+ |
+ // GlyphBufferBloberizer splits for a new blob rotation, but does not split |
+ // for a change in font. A TextBlob can contain runs with differing fonts |
+ // and the getTextBlobIntercepts method handles multiple fonts for us. For |
+ // upright in vertical blobs we currently have to bail, see crbug.com/655154 |
+ if (blob.second == BlobRotation::CCWRotation) |
+ continue; |
+ |
+ SkScalar* offsetIntervals = nullptr; |
+ if (intervals) { |
+ // Continue writing the results for the n-th blob after the previous few. |
+ offsetIntervals = &intervals[numIntervals]; |
+ } |
+ numIntervals += |
+ paint.getTextBlobIntercepts(blob.first.get(), bounds, offsetIntervals); |
+ } |
+ |
+ return numIntervals; |
+} |
+ |
static inline FloatRect pixelSnappedSelectionRect(FloatRect rect) { |
// Using roundf() rather than ceilf() for the right edge as a compromise to |
// ensure correct caret positioning. |