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

Side by Side Diff: Source/platform/fonts/CustomFontData.h

Issue 171823002: Make text visible when font loading takes longer than 3 seconds (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google, Inc. 2 * Copyright (C) 2013 Google, Inc.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 19 matching lines...) Expand all
30 namespace WebCore { 30 namespace WebCore {
31 31
32 class CSSFontFaceSource; 32 class CSSFontFaceSource;
33 struct GlyphData; 33 struct GlyphData;
34 class GlyphPage; 34 class GlyphPage;
35 class SimpleFontData; 35 class SimpleFontData;
36 struct WidthIterator; 36 struct WidthIterator;
37 37
38 class PLATFORM_EXPORT CustomFontData : public RefCounted<CustomFontData> { 38 class PLATFORM_EXPORT CustomFontData : public RefCounted<CustomFontData> {
39 public: 39 public:
40 static PassRefPtr<CustomFontData> create(bool isLoadingFallback = false) 40 static PassRefPtr<CustomFontData> create(bool isLoadingFallback = false, boo l skipDrawing = false)
41 { 41 {
42 return adoptRef(new CustomFontData(isLoadingFallback)); 42 return adoptRef(new CustomFontData(isLoadingFallback, skipDrawing));
43 } 43 }
44 44
45 virtual ~CustomFontData() { } 45 virtual ~CustomFontData() { }
46 46
47 virtual void beginLoadIfNeeded() const { }; 47 virtual void beginLoadIfNeeded() const { };
48 bool isLoading() const { return m_isLoadingFallback && m_isUsed; } 48 bool isLoading() const { return m_isLoadingFallback && m_isUsed; }
49 bool isLoadingFallback() const { return m_isLoadingFallback; } 49 bool isLoadingFallback() const { return m_isLoadingFallback; }
50 bool shouldSkipDrawing() const { return m_skipDrawing && m_isUsed; }
50 51
51 virtual bool isSVGFont() const { return false; } 52 virtual bool isSVGFont() const { return false; }
52 virtual void initializeFontData(SimpleFontData*, float) { } 53 virtual void initializeFontData(SimpleFontData*, float) { }
53 virtual float widthForSVGGlyph(Glyph, float) const { return 0.0f; } 54 virtual float widthForSVGGlyph(Glyph, float) const { return 0.0f; }
54 virtual bool fillSVGGlyphPage(GlyphPage*, unsigned, unsigned, UChar*, unsign ed, const SimpleFontData*) const { return false; } 55 virtual bool fillSVGGlyphPage(GlyphPage*, unsigned, unsigned, UChar*, unsign ed, const SimpleFontData*) const { return false; }
55 virtual bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool, int, u nsigned&) const { return false; } 56 virtual bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool, int, u nsigned&) const { return false; }
56 57
57 virtual void setCSSFontFaceSource(CSSFontFaceSource* source) { ASSERT_NOT_RE ACHED(); } 58 virtual void setCSSFontFaceSource(CSSFontFaceSource* source) { ASSERT_NOT_RE ACHED(); }
58 virtual void clearCSSFontFaceSource() { } 59 virtual void clearCSSFontFaceSource() { }
59 60
60 protected: 61 protected:
61 CustomFontData(bool isLoadingFallback) 62 CustomFontData(bool isLoadingFallback, bool skipDrawing)
62 : m_isLoadingFallback(isLoadingFallback) 63 : m_isLoadingFallback(isLoadingFallback)
64 , m_skipDrawing(skipDrawing)
63 , m_isUsed(false) 65 , m_isUsed(false)
64 { 66 {
65 } 67 }
66 68
67 bool m_isLoadingFallback; // Whether or not this is a temporary font data fo r a custom font which is not yet loaded. 69 bool m_isLoadingFallback;
70 bool m_skipDrawing;
68 mutable bool m_isUsed; 71 mutable bool m_isUsed;
69 }; 72 };
70 73
71 } 74 }
72 75
73 #endif // CustomFontData_h 76 #endif // CustomFontData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698