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

Unified Diff: Source/core/css/CSSFontFace.cpp

Issue 103273002: CSSSegmentedFontFaceCache should not know about Document. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/CSSFontFace.h ('k') | Source/core/css/CSSFontSelector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSFontFace.cpp
diff --git a/Source/core/css/CSSFontFace.cpp b/Source/core/css/CSSFontFace.cpp
index f461a5adbe3959a8e76e696114eaf3283225d0ee..fee3a718e05d9dbbd9523ec006bae4c1daf06626 100644
--- a/Source/core/css/CSSFontFace.cpp
+++ b/Source/core/css/CSSFontFace.cpp
@@ -35,6 +35,25 @@
namespace WebCore {
+PassRefPtr<CSSFontFace> CSSFontFace::createFromStyleRule(Document* document, const StyleRuleFontFace* fontFaceRule)
+{
+ RefPtr<FontFace> fontFace = FontFace::create(fontFaceRule);
+ if (!fontFace || fontFace->family().isEmpty())
+ return 0;
+
+ unsigned traitsMask = fontFace->traitsMask();
+ if (!traitsMask)
+ return 0;
+
+ // FIXME: Plumbing back into createCSSFontFace seems odd.
+ // Maybe move FontFace::createCSSFontFace logic here?
+ RefPtr<CSSFontFace> cssFontFace = fontFace->createCSSFontFace(document);
+ if (!cssFontFace || !cssFontFace->isValid())
+ return 0;
+
+ return cssFontFace;
+}
+
bool CSSFontFace::isLoaded() const
{
size_t size = m_sources.size();
« no previous file with comments | « Source/core/css/CSSFontFace.h ('k') | Source/core/css/CSSFontSelector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698