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

Side by Side Diff: sky/engine/core/css/CSSCustomFontData.h

Issue 1223843003: Remove support for loading remote font faces (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/css/CSSFontFace.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2013 Google, Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21 #ifndef SKY_ENGINE_CORE_CSS_CSSCUSTOMFONTDATA_H_
22 #define SKY_ENGINE_CORE_CSS_CSSCUSTOMFONTDATA_H_
23
24 #include "sky/engine/core/css/CSSFontFaceSource.h"
25 #include "sky/engine/platform/fonts/CustomFontData.h"
26
27 namespace blink {
28
29 class CSSCustomFontData final : public CustomFontData {
30 public:
31 enum FallbackVisibility { InvisibleFallback, VisibleFallback };
32
33 static PassRefPtr<CSSCustomFontData> create(RemoteFontFaceSource* source, Fa llbackVisibility visibility)
34 {
35 return adoptRef(new CSSCustomFontData(source, visibility));
36 }
37
38 virtual ~CSSCustomFontData() { }
39
40 virtual bool shouldSkipDrawing() const override
41 {
42 if (m_fontFaceSource)
43 m_fontFaceSource->paintRequested();
44 return m_fallbackVisibility == InvisibleFallback && m_isLoading;
45 }
46
47 virtual void beginLoadIfNeeded() const override
48 {
49 if (!m_isLoading && m_fontFaceSource) {
50 m_isLoading = true;
51 m_fontFaceSource->beginLoadIfNeeded();
52 }
53 }
54
55 virtual bool isLoading() const override { return m_isLoading; }
56 virtual bool isLoadingFallback() const override { return true; }
57 virtual void clearFontFaceSource() override { m_fontFaceSource = 0; }
58
59 private:
60 CSSCustomFontData(RemoteFontFaceSource* source, FallbackVisibility visibilit y)
61 : m_fontFaceSource(source)
62 , m_fallbackVisibility(visibility)
63 , m_isLoading(false)
64 {
65 if (source)
66 m_isLoading = source->isLoading();
67 }
68
69 RemoteFontFaceSource* m_fontFaceSource;
70 FallbackVisibility m_fallbackVisibility;
71 mutable bool m_isLoading;
72 };
73
74 }
75
76 #endif // SKY_ENGINE_CORE_CSS_CSSCUSTOMFONTDATA_H_
OLDNEW
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/css/CSSFontFace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698