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> | |
34 | 33 |
35 namespace blink { | 34 namespace blink { |
36 | 35 |
37 CSSPreloadScanner::CSSPreloadScanner() | 36 CSSPreloadScanner::CSSPreloadScanner() |
38 { | 37 { |
39 } | 38 } |
40 | 39 |
41 CSSPreloadScanner::~CSSPreloadScanner() | 40 CSSPreloadScanner::~CSSPreloadScanner() |
42 { | 41 { |
43 } | 42 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 213 |
215 return string.substring(offset, reducedLength); | 214 return string.substring(offset, reducedLength); |
216 } | 215 } |
217 | 216 |
218 void CSSPreloadScanner::emitRule(const SegmentedString& source) | 217 void CSSPreloadScanner::emitRule(const SegmentedString& source) |
219 { | 218 { |
220 if (equalIgnoringCase(m_rule, "import")) { | 219 if (equalIgnoringCase(m_rule, "import")) { |
221 String url = parseCSSStringOrURL(m_ruleValue.toString()); | 220 String url = parseCSSStringOrURL(m_ruleValue.toString()); |
222 if (!url.isEmpty()) { | 221 if (!url.isEmpty()) { |
223 TextPosition position = TextPosition(source.currentLine(), source.cu
rrentColumn()); | 222 TextPosition position = TextPosition(source.currentLine(), source.cu
rrentColumn()); |
224 std::unique_ptr<PreloadRequest> request = PreloadRequest::create(Fet
chInitiatorTypeNames::css, position, url, *m_predictedBaseElementURL, Resource::
CSSStyleSheet, m_referrerPolicy); | 223 OwnPtr<PreloadRequest> request = PreloadRequest::create(FetchInitiat
orTypeNames::css, position, url, *m_predictedBaseElementURL, Resource::CSSStyleS
heet, m_referrerPolicy); |
225 // FIXME: Should this be including the charset in the preload reques
t? | 224 // FIXME: Should this be including the charset in the preload reques
t? |
226 m_requests->append(std::move(request)); | 225 m_requests->append(std::move(request)); |
227 } | 226 } |
228 m_state = Initial; | 227 m_state = Initial; |
229 } else if (equalIgnoringCase(m_rule, "charset")) | 228 } else if (equalIgnoringCase(m_rule, "charset")) |
230 m_state = Initial; | 229 m_state = Initial; |
231 else | 230 else |
232 m_state = DoneParsingImportRules; | 231 m_state = DoneParsingImportRules; |
233 m_rule.clear(); | 232 m_rule.clear(); |
234 m_ruleValue.clear(); | 233 m_ruleValue.clear(); |
235 } | 234 } |
236 | 235 |
237 } // namespace blink | 236 } // namespace blink |
OLD | NEW |