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

Side by Side Diff: Source/core/css/CSSFontFace.h

Issue 23446007: Use unicode-range to prevent unnecessary @font-face donwnloads (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase and add toSegmentedFontData() Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple 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 19 matching lines...) Expand all
30 #include "core/css/FontFace.h" 30 #include "core/css/FontFace.h"
31 #include "wtf/Forward.h" 31 #include "wtf/Forward.h"
32 #include "wtf/PassRefPtr.h" 32 #include "wtf/PassRefPtr.h"
33 #include "wtf/RefCounted.h" 33 #include "wtf/RefCounted.h"
34 #include "wtf/Vector.h" 34 #include "wtf/Vector.h"
35 35
36 namespace WebCore { 36 namespace WebCore {
37 37
38 class CSSSegmentedFontFace; 38 class CSSSegmentedFontFace;
39 class FontDescription; 39 class FontDescription;
40 class FontResource;
40 class SimpleFontData; 41 class SimpleFontData;
41 42
42 // FIXME: Can this be a subclass of FontFace? 43 // FIXME: Can this be a subclass of FontFace?
43 class CSSFontFace : public RefCounted<CSSFontFace> { 44 class CSSFontFace : public RefCounted<CSSFontFace> {
44 public: 45 public:
45 static PassRefPtr<CSSFontFace> create(PassRefPtr<FontFace> fontFace) { retur n adoptRef(new CSSFontFace(fontFace)); } 46 static PassRefPtr<CSSFontFace> create(PassRefPtr<FontFace> fontFace) { retur n adoptRef(new CSSFontFace(fontFace)); }
46 47
47 struct UnicodeRange; 48 struct UnicodeRange;
48 49
49 FontFace* fontFace() const { return m_fontFace.get(); } 50 FontFace* fontFace() const { return m_fontFace.get(); }
50 51
51 void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); } 52 void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); }
52 const Vector<UnicodeRange>& ranges() const { return m_ranges; } 53 const Vector<UnicodeRange>& ranges() const { return m_ranges; }
53 54
54 void setSegmentedFontFace(CSSSegmentedFontFace*); 55 void setSegmentedFontFace(CSSSegmentedFontFace*);
55 void clearSegmentedFontFace() { m_segmentedFontFace = 0; } 56 void clearSegmentedFontFace() { m_segmentedFontFace = 0; }
56 57
57 bool isLoaded() const; 58 bool isLoaded() const;
58 bool isValid() const; 59 bool isValid() const;
59 60
60 void addSource(PassOwnPtr<CSSFontFaceSource>); 61 void addSource(PassOwnPtr<CSSFontFaceSource>);
61 62
63 void beginLoadingFontSoon(FontResource*);
62 void fontLoaded(CSSFontFaceSource*); 64 void fontLoaded(CSSFontFaceSource*);
63 65
64 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, bool syntheti cBold, bool syntheticItalic); 66 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, bool syntheti cBold, bool syntheticItalic);
65 67
66 struct UnicodeRange { 68 struct UnicodeRange {
67 UnicodeRange(UChar32 from, UChar32 to) 69 UnicodeRange(UChar32 from, UChar32 to)
68 : m_from(from) 70 : m_from(from)
69 , m_to(to) 71 , m_to(to)
70 { 72 {
71 } 73 }
(...skipping 25 matching lines...) Expand all
97 Vector<UnicodeRange> m_ranges; 99 Vector<UnicodeRange> m_ranges;
98 CSSSegmentedFontFace* m_segmentedFontFace; 100 CSSSegmentedFontFace* m_segmentedFontFace;
99 Vector<OwnPtr<CSSFontFaceSource> > m_sources; 101 Vector<OwnPtr<CSSFontFaceSource> > m_sources;
100 CSSFontFaceSource* m_activeSource; 102 CSSFontFaceSource* m_activeSource;
101 RefPtr<FontFace> m_fontFace; 103 RefPtr<FontFace> m_fontFace;
102 }; 104 };
103 105
104 } 106 }
105 107
106 #endif 108 #endif
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/font-face-unicode-range-load-expected.txt ('k') | Source/core/css/CSSFontFace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698