OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 #include "core/css/CSSMarkup.h" | 28 #include "core/css/CSSMarkup.h" |
29 #include "core/css/StyleSheetContents.h" | 29 #include "core/css/StyleSheetContents.h" |
30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
31 #include "core/dom/Node.h" | 31 #include "core/dom/Node.h" |
32 #include "core/fetch/FetchInitiatorTypeNames.h" | 32 #include "core/fetch/FetchInitiatorTypeNames.h" |
33 #include "core/fetch/FetchRequest.h" | 33 #include "core/fetch/FetchRequest.h" |
34 #include "core/fetch/ResourceFetcher.h" | 34 #include "core/fetch/ResourceFetcher.h" |
35 #include "core/loader/MixedContentChecker.h" | 35 #include "core/loader/MixedContentChecker.h" |
36 #include "core/loader/resource/FontResource.h" | 36 #include "core/loader/resource/FontResource.h" |
37 #include "platform/CrossOriginAttributeValue.h" | 37 #include "platform/CrossOriginAttributeValue.h" |
| 38 #include "platform/RuntimeEnabledFeatures.h" |
38 #include "platform/fonts/FontCache.h" | 39 #include "platform/fonts/FontCache.h" |
39 #include "platform/fonts/FontCustomPlatformData.h" | 40 #include "platform/fonts/FontCustomPlatformData.h" |
40 #include "platform/weborigin/SecurityPolicy.h" | 41 #include "platform/weborigin/SecurityPolicy.h" |
41 #include "wtf/text/StringBuilder.h" | 42 #include "wtf/text/StringBuilder.h" |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 bool CSSFontFaceSrcValue::isSupportedFormat() const { | 46 bool CSSFontFaceSrcValue::isSupportedFormat() const { |
46 // Normally we would just check the format, but in order to avoid conflicts | 47 // Normally we would just check the format, but in order to avoid conflicts |
47 // with the old WinIE style of font-face, we will also check to see if the URL | 48 // with the old WinIE style of font-face, we will also check to see if the URL |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 return; | 85 return; |
85 | 86 |
86 request.setCrossOriginAccessControl(securityOrigin, | 87 request.setCrossOriginAccessControl(securityOrigin, |
87 CrossOriginAttributeAnonymous); | 88 CrossOriginAttributeAnonymous); |
88 } | 89 } |
89 | 90 |
90 FontResource* CSSFontFaceSrcValue::fetch(Document* document) const { | 91 FontResource* CSSFontFaceSrcValue::fetch(Document* document) const { |
91 if (!m_fetched) { | 92 if (!m_fetched) { |
92 FetchRequest request(ResourceRequest(m_absoluteResource), | 93 FetchRequest request(ResourceRequest(m_absoluteResource), |
93 FetchInitiatorTypeNames::css); | 94 FetchInitiatorTypeNames::css); |
| 95 if (RuntimeEnabledFeatures::webFontsCacheAwareTimeoutAdaptationEnabled()) |
| 96 request.setCacheAwareLoadingEnabled(IsCacheAwareLoadingEnabled); |
94 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy); | 97 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy); |
95 SecurityOrigin* securityOrigin = document->getSecurityOrigin(); | 98 SecurityOrigin* securityOrigin = document->getSecurityOrigin(); |
96 setCrossOriginAccessControl(request, securityOrigin); | 99 setCrossOriginAccessControl(request, securityOrigin); |
97 request.mutableResourceRequest().setHTTPReferrer( | 100 request.mutableResourceRequest().setHTTPReferrer( |
98 SecurityPolicy::generateReferrer(m_referrer.referrerPolicy, | 101 SecurityPolicy::generateReferrer(m_referrer.referrerPolicy, |
99 request.url(), m_referrer.referrer)); | 102 request.url(), m_referrer.referrer)); |
100 FontResource* resource = FontResource::fetch(request, document->fetcher()); | 103 FontResource* resource = FontResource::fetch(request, document->fetcher()); |
101 if (!resource) | 104 if (!resource) |
102 return nullptr; | 105 return nullptr; |
103 m_fetched = FontResourceHelper::create(resource); | 106 m_fetched = FontResourceHelper::create(resource); |
(...skipping 28 matching lines...) Expand all Loading... |
132 ResourceFetcher::ResourceLoadingFromCache); | 135 ResourceFetcher::ResourceLoadingFromCache); |
133 } | 136 } |
134 | 137 |
135 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const { | 138 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const { |
136 return m_isLocal == other.m_isLocal && m_format == other.m_format && | 139 return m_isLocal == other.m_isLocal && m_format == other.m_format && |
137 m_specifiedResource == other.m_specifiedResource && | 140 m_specifiedResource == other.m_specifiedResource && |
138 m_absoluteResource == other.m_absoluteResource; | 141 m_absoluteResource == other.m_absoluteResource; |
139 } | 142 } |
140 | 143 |
141 } // namespace blink | 144 } // namespace blink |
OLD | NEW |