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

Side by Side Diff: Source/core/css/CSSFontFaceSrcValue.cpp

Issue 656913006: Remove SVG fonts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update tests for landing Created 6 years, 2 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, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2010 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 15 matching lines...) Expand all
26 #include "config.h" 26 #include "config.h"
27 #include "core/css/CSSFontFaceSrcValue.h" 27 #include "core/css/CSSFontFaceSrcValue.h"
28 28
29 #include "core/FetchInitiatorTypeNames.h" 29 #include "core/FetchInitiatorTypeNames.h"
30 #include "core/css/StyleSheetContents.h" 30 #include "core/css/StyleSheetContents.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/Node.h" 32 #include "core/dom/Node.h"
33 #include "core/fetch/FetchRequest.h" 33 #include "core/fetch/FetchRequest.h"
34 #include "core/fetch/FontResource.h" 34 #include "core/fetch/FontResource.h"
35 #include "core/fetch/ResourceFetcher.h" 35 #include "core/fetch/ResourceFetcher.h"
36 #include "core/svg/SVGFontFaceElement.h"
37 #include "platform/fonts/FontCache.h" 36 #include "platform/fonts/FontCache.h"
38 #include "platform/fonts/FontCustomPlatformData.h" 37 #include "platform/fonts/FontCustomPlatformData.h"
39 #include "wtf/text/StringBuilder.h" 38 #include "wtf/text/StringBuilder.h"
40 39
41 namespace blink { 40 namespace blink {
42 41
43 #if ENABLE(SVG_FONTS)
44 bool CSSFontFaceSrcValue::isSVGFontFaceSrc() const
45 {
46 return equalIgnoringCase(m_format, "svg");
47 }
48 #endif
49
50 bool CSSFontFaceSrcValue::isSupportedFormat() const 42 bool CSSFontFaceSrcValue::isSupportedFormat() const
51 { 43 {
52 // Normally we would just check the format, but in order to avoid conflicts with the old WinIE style of font-face, 44 // Normally we would just check the format, but in order to avoid conflicts with the old WinIE style of font-face,
53 // we will also check to see if the URL ends with .eot. If so, we'll go ahe ad and assume that we shouldn't load it. 45 // we will also check to see if the URL ends with .eot. If so, we'll go ahe ad and assume that we shouldn't load it.
54 if (m_format.isEmpty()) { 46 if (m_format.isEmpty()) {
55 // Check for .eot. 47 // Check for .eot.
56 if (!m_resource.startsWith("data:", false) && m_resource.endsWith(".eot" , false)) 48 if (!m_resource.startsWith("data:", false) && m_resource.endsWith(".eot" , false))
57 return false; 49 return false;
58 return true; 50 return true;
59 } 51 }
60 52
61 if (FontCustomPlatformData::supportsFormat(m_format)) 53 if (FontCustomPlatformData::supportsFormat(m_format))
62 return true; 54 return true;
63 55
64 // We have removed SVG font support on non-gdi platforms. For details, see:
65 // https://groups.google.com/a/chromium.org/d/msg/blink-dev/pYbbUcYvlYY/LQvF vM8KZZEJ
66 #if ENABLE(SVG_FONTS)
67 if (RuntimeEnabledFeatures::svgFontsOnNonGDIPlatformsEnabled()
68 #if OS(WIN)
69 || !FontCache::useDirectWrite()
70 #endif
71 )
72 return isSVGFontFaceSrc();
73 #endif
74 return false; 56 return false;
75 } 57 }
76 58
77 String CSSFontFaceSrcValue::customCSSText() const 59 String CSSFontFaceSrcValue::customCSSText() const
78 { 60 {
79 StringBuilder result; 61 StringBuilder result;
80 if (isLocal()) 62 if (isLocal())
81 result.appendLiteral("local("); 63 result.appendLiteral("local(");
82 else 64 else
83 result.appendLiteral("url("); 65 result.appendLiteral("url(");
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 document->fetcher()->maybeNotifyInsecureContent(m_fetched.get()); 118 document->fetcher()->maybeNotifyInsecureContent(m_fetched.get());
137 document->fetcher()->requestLoadStarted(m_fetched.get(), request, ResourceFe tcher::ResourceLoadingFromCache); 119 document->fetcher()->requestLoadStarted(m_fetched.get(), request, ResourceFe tcher::ResourceLoadingFromCache);
138 } 120 }
139 121
140 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const 122 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const
141 { 123 {
142 return m_isLocal == other.m_isLocal && m_format == other.m_format && m_resou rce == other.m_resource; 124 return m_isLocal == other.m_isLocal && m_format == other.m_format && m_resou rce == other.m_resource;
143 } 125 }
144 126
145 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698