Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ | 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ |
| 4 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 4 * Copyright (C) 2010 Google Inc. All Rights Reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 while (reducedLength && | 224 while (reducedLength && |
| 225 isHTMLSpace<UChar>(string[offset + reducedLength - 1])) | 225 isHTMLSpace<UChar>(string[offset + reducedLength - 1])) |
| 226 --reducedLength; | 226 --reducedLength; |
| 227 | 227 |
| 228 return string.substring(offset, reducedLength); | 228 return string.substring(offset, reducedLength); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void CSSPreloadScanner::emitRule(const SegmentedString& source) { | 231 void CSSPreloadScanner::emitRule(const SegmentedString& source) { |
| 232 if (equalIgnoringCase(m_rule, "import")) { | 232 if (equalIgnoringCase(m_rule, "import")) { |
| 233 String url = parseCSSStringOrURL(m_ruleValue.toString()); | 233 String url = parseCSSStringOrURL(m_ruleValue.toString()); |
| 234 if (!url.isEmpty()) { | 234 TextPosition position = |
| 235 TextPosition position = | 235 TextPosition(source.currentLine(), source.currentColumn()); |
| 236 TextPosition(source.currentLine(), source.currentColumn()); | 236 std::unique_ptr<PreloadRequest> request = PreloadRequest::createIfNeeded( |
|
Yoav Weiss
2016/10/25 04:34:14
Nit: should this be "auto request"?
Charlie Harrison
2016/10/25 13:32:47
Sure. Done.
| |
| 237 std::unique_ptr<PreloadRequest> request = | 237 FetchInitiatorTypeNames::css, position, url, *m_predictedBaseElementURL, |
| 238 PreloadRequest::create(FetchInitiatorTypeNames::css, position, url, | 238 Resource::CSSStyleSheet, m_referrerPolicy); |
| 239 *m_predictedBaseElementURL, | 239 if (request) { |
| 240 Resource::CSSStyleSheet, m_referrerPolicy); | |
| 241 // FIXME: Should this be including the charset in the preload request? | 240 // FIXME: Should this be including the charset in the preload request? |
| 242 m_requests->append(std::move(request)); | 241 m_requests->append(std::move(request)); |
| 243 } | 242 } |
| 244 m_state = Initial; | 243 m_state = Initial; |
| 245 } else if (equalIgnoringCase(m_rule, "charset")) | 244 } else if (equalIgnoringCase(m_rule, "charset")) |
| 246 m_state = Initial; | 245 m_state = Initial; |
| 247 else | 246 else |
| 248 m_state = DoneParsingImportRules; | 247 m_state = DoneParsingImportRules; |
| 249 m_rule.clear(); | 248 m_rule.clear(); |
| 250 m_ruleValue.clear(); | 249 m_ruleValue.clear(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 currentPreloadCount); | 319 currentPreloadCount); |
| 321 } | 320 } |
| 322 } | 321 } |
| 323 | 322 |
| 324 DEFINE_TRACE(CSSPreloaderResourceClient) { | 323 DEFINE_TRACE(CSSPreloaderResourceClient) { |
| 325 visitor->trace(m_preloader); | 324 visitor->trace(m_preloader); |
| 326 ResourceOwner<CSSStyleSheetResource>::trace(visitor); | 325 ResourceOwner<CSSStyleSheetResource>::trace(visitor); |
| 327 } | 326 } |
| 328 | 327 |
| 329 } // namespace blink | 328 } // namespace blink |
| OLD | NEW |