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

Side by Side Diff: Source/platform/fonts/Font.cpp

Issue 1314843009: Add DocumentTiming metrics for "time to first text paint" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. 6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return width; 136 return width;
137 } 137 }
138 138
139 void Font::drawText(SkCanvas* canvas, const TextRunPaintInfo& runInfo, 139 void Font::drawText(SkCanvas* canvas, const TextRunPaintInfo& runInfo,
140 const FloatPoint& point, float deviceScaleFactor, const SkPaint& paint) cons t 140 const FloatPoint& point, float deviceScaleFactor, const SkPaint& paint) cons t
141 { 141 {
142 // Don't draw anything while we are using custom fonts that are in the proce ss of loading. 142 // Don't draw anything while we are using custom fonts that are in the proce ss of loading.
143 if (shouldSkipDrawing()) 143 if (shouldSkipDrawing())
144 return; 144 return;
145 145
146 if (fontSelector())
drott 2015/09/16 07:26:20 If I am not mistaken, this keeps calling reportFir
Kunihiko Sakamoto 2015/09/17 08:36:10 That's right - I optimistically assumed the functi
147 fontSelector()->reportFirstNonBlankText(m_fontFallbackList->hasCustomFon t());
148
146 if (runInfo.cachedTextBlob && runInfo.cachedTextBlob->get()) { 149 if (runInfo.cachedTextBlob && runInfo.cachedTextBlob->get()) {
147 // we have a pre-cached blob -- happy joy! 150 // we have a pre-cached blob -- happy joy!
148 drawTextBlob(canvas, paint, runInfo.cachedTextBlob->get(), point.data()) ; 151 drawTextBlob(canvas, paint, runInfo.cachedTextBlob->get(), point.data()) ;
149 return; 152 return;
150 } 153 }
151 154
152 GlyphBuffer glyphBuffer; 155 GlyphBuffer glyphBuffer;
153 buildGlyphBuffer(runInfo, glyphBuffer); 156 buildGlyphBuffer(runInfo, glyphBuffer);
154 157
155 drawGlyphBuffer(canvas, paint, runInfo, glyphBuffer, point, deviceScaleFacto r); 158 drawGlyphBuffer(canvas, paint, runInfo, glyphBuffer, point, deviceScaleFacto r);
156 } 159 }
157 160
158 void Font::drawBidiText(SkCanvas* canvas, const TextRunPaintInfo& runInfo, const FloatPoint& point, CustomFontNotReadyAction customFontNotReadyAction, float dev iceScaleFactor, const SkPaint& paint) const 161 void Font::drawBidiText(SkCanvas* canvas, const TextRunPaintInfo& runInfo, const FloatPoint& point, CustomFontNotReadyAction customFontNotReadyAction, float dev iceScaleFactor, const SkPaint& paint) const
159 { 162 {
160 // Don't draw anything while we are using custom fonts that are in the proce ss of loading, 163 // Don't draw anything while we are using custom fonts that are in the proce ss of loading,
161 // except if the 'force' argument is set to true (in which case it will use a fallback 164 // except if the 'force' argument is set to true (in which case it will use a fallback
162 // font). 165 // font).
163 if (shouldSkipDrawing() && customFontNotReadyAction == DoNotPaintIfFontNotRe ady) 166 if (shouldSkipDrawing() && customFontNotReadyAction == DoNotPaintIfFontNotRe ady)
164 return; 167 return;
165 168
169 if (fontSelector())
drott 2015/09/16 07:26:20 Dito.
170 fontSelector()->reportFirstNonBlankText(m_fontFallbackList->hasCustomFon t());
171
166 // sub-run painting is not supported for Bidi text. 172 // sub-run painting is not supported for Bidi text.
167 const TextRun& run = runInfo.run; 173 const TextRun& run = runInfo.run;
168 ASSERT((runInfo.from == 0) && (runInfo.to == run.length())); 174 ASSERT((runInfo.from == 0) && (runInfo.to == run.length()));
169 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; 175 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
170 bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride() )); 176 bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride() ));
171 bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0)); 177 bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0));
172 178
173 // FIXME: This ownership should be reversed. We should pass BidiRunList 179 // FIXME: This ownership should be reversed. We should pass BidiRunList
174 // to BidiResolver in createBidiRunsForLine. 180 // to BidiResolver in createBidiRunsForLine.
175 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs(); 181 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs();
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 { 827 {
822 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); 828 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts();
823 } 829 }
824 830
825 bool Font::isFallbackValid() const 831 bool Font::isFallbackValid() const
826 { 832 {
827 return !m_fontFallbackList || m_fontFallbackList->isValid(); 833 return !m_fontFallbackList || m_fontFallbackList->isValid();
828 } 834 }
829 835
830 } // namespace blink 836 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698