| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (RuntimeEnabledFeatures::webFontsCacheAwareTimeoutAdaptationEnabled()) | 96 if (RuntimeEnabledFeatures::webFontsCacheAwareTimeoutAdaptationEnabled()) |
| 97 request.SetCacheAwareLoadingEnabled(kIsCacheAwareLoadingEnabled); | 97 request.SetCacheAwareLoadingEnabled(kIsCacheAwareLoadingEnabled); |
| 98 request.SetContentSecurityCheck(should_check_content_security_policy_); | 98 request.SetContentSecurityCheck(should_check_content_security_policy_); |
| 99 SecurityOrigin* security_origin = document->GetSecurityOrigin(); | 99 SecurityOrigin* security_origin = document->GetSecurityOrigin(); |
| 100 SetCrossOriginAccessControl(request, security_origin); | 100 SetCrossOriginAccessControl(request, security_origin); |
| 101 FontResource* resource = FontResource::Fetch(request, document->Fetcher()); | 101 FontResource* resource = FontResource::Fetch(request, document->Fetcher()); |
| 102 if (!resource) | 102 if (!resource) |
| 103 return nullptr; | 103 return nullptr; |
| 104 fetched_ = FontResourceHelper::Create(resource); | 104 fetched_ = FontResourceHelper::Create(resource); |
| 105 } else { | 105 } else { |
| 106 // FIXME: CSSFontFaceSrcValue::fetch is invoked when @font-face rule | 106 // FIXME: CSSFontFaceSrcValue::Fetch is invoked when @font-face rule |
| 107 // is processed by StyleResolver / StyleEngine. | 107 // is processed by StyleResolver / StyleEngine. |
| 108 RestoreCachedResourceIfNeeded(document); | 108 RestoreCachedResourceIfNeeded(document); |
| 109 } | 109 } |
| 110 return fetched_->GetResource(); | 110 return fetched_->GetResource(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void CSSFontFaceSrcValue::RestoreCachedResourceIfNeeded( | 113 void CSSFontFaceSrcValue::RestoreCachedResourceIfNeeded( |
| 114 Document* document) const { | 114 Document* document) const { |
| 115 DCHECK(fetched_); | 115 DCHECK(fetched_); |
| 116 DCHECK(document); | 116 DCHECK(document); |
| 117 DCHECK(document->Fetcher()); | 117 DCHECK(document->Fetcher()); |
| 118 | 118 |
| 119 const String resource_url = document->CompleteURL(absolute_resource_); | 119 const String resource_url = document->CompleteURL(absolute_resource_); |
| 120 DCHECK_EQ(should_check_content_security_policy_, | 120 DCHECK_EQ(should_check_content_security_policy_, |
| 121 fetched_->GetResource()->Options().content_security_policy_option); | 121 fetched_->GetResource()->Options().content_security_policy_option); |
| 122 document->Fetcher()->EmulateLoadStartedForInspector( | 122 document->Fetcher()->EmulateLoadStartedForInspector( |
| 123 fetched_->GetResource(), KURL(kParsedURLString, resource_url), | 123 fetched_->GetResource(), KURL(kParsedURLString, resource_url), |
| 124 WebURLRequest::kRequestContextFont, FetchInitiatorTypeNames::css); | 124 WebURLRequest::kRequestContextFont, FetchInitiatorTypeNames::css); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool CSSFontFaceSrcValue::Equals(const CSSFontFaceSrcValue& other) const { | 127 bool CSSFontFaceSrcValue::Equals(const CSSFontFaceSrcValue& other) const { |
| 128 return is_local_ == other.is_local_ && format_ == other.format_ && | 128 return is_local_ == other.is_local_ && format_ == other.format_ && |
| 129 specified_resource_ == other.specified_resource_ && | 129 specified_resource_ == other.specified_resource_ && |
| 130 absolute_resource_ == other.absolute_resource_; | 130 absolute_resource_ == other.absolute_resource_; |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace blink | 133 } // namespace blink |
| OLD | NEW |