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 12 matching lines...) Expand all Loading... |
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "core/html/parser/CSSPreloadScanner.h" | 28 #include "core/html/parser/CSSPreloadScanner.h" |
29 | 29 |
30 #include "core/fetch/FetchInitiatorTypeNames.h" | 30 #include "core/fetch/FetchInitiatorTypeNames.h" |
31 #include "core/html/parser/HTMLParserIdioms.h" | 31 #include "core/html/parser/HTMLParserIdioms.h" |
32 #include "platform/text/SegmentedString.h" | 32 #include "platform/text/SegmentedString.h" |
| 33 #include <memory> |
33 | 34 |
34 namespace blink { | 35 namespace blink { |
35 | 36 |
36 CSSPreloadScanner::CSSPreloadScanner() | 37 CSSPreloadScanner::CSSPreloadScanner() |
37 { | 38 { |
38 } | 39 } |
39 | 40 |
40 CSSPreloadScanner::~CSSPreloadScanner() | 41 CSSPreloadScanner::~CSSPreloadScanner() |
41 { | 42 { |
42 } | 43 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 214 |
214 return string.substring(offset, reducedLength); | 215 return string.substring(offset, reducedLength); |
215 } | 216 } |
216 | 217 |
217 void CSSPreloadScanner::emitRule(const SegmentedString& source) | 218 void CSSPreloadScanner::emitRule(const SegmentedString& source) |
218 { | 219 { |
219 if (equalIgnoringCase(m_rule, "import")) { | 220 if (equalIgnoringCase(m_rule, "import")) { |
220 String url = parseCSSStringOrURL(m_ruleValue.toString()); | 221 String url = parseCSSStringOrURL(m_ruleValue.toString()); |
221 if (!url.isEmpty()) { | 222 if (!url.isEmpty()) { |
222 TextPosition position = TextPosition(source.currentLine(), source.cu
rrentColumn()); | 223 TextPosition position = TextPosition(source.currentLine(), source.cu
rrentColumn()); |
223 OwnPtr<PreloadRequest> request = PreloadRequest::create(FetchInitiat
orTypeNames::css, position, url, *m_predictedBaseElementURL, Resource::CSSStyleS
heet, m_referrerPolicy); | 224 std::unique_ptr<PreloadRequest> request = PreloadRequest::create(Fet
chInitiatorTypeNames::css, position, url, *m_predictedBaseElementURL, Resource::
CSSStyleSheet, m_referrerPolicy); |
224 // FIXME: Should this be including the charset in the preload reques
t? | 225 // FIXME: Should this be including the charset in the preload reques
t? |
225 m_requests->append(std::move(request)); | 226 m_requests->append(std::move(request)); |
226 } | 227 } |
227 m_state = Initial; | 228 m_state = Initial; |
228 } else if (equalIgnoringCase(m_rule, "charset")) | 229 } else if (equalIgnoringCase(m_rule, "charset")) |
229 m_state = Initial; | 230 m_state = Initial; |
230 else | 231 else |
231 m_state = DoneParsingImportRules; | 232 m_state = DoneParsingImportRules; |
232 m_rule.clear(); | 233 m_rule.clear(); |
233 m_ruleValue.clear(); | 234 m_ruleValue.clear(); |
234 } | 235 } |
235 | 236 |
236 } // namespace blink | 237 } // namespace blink |
OLD | NEW |