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 11 matching lines...) Expand all Loading... | |
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
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 "config.h" | 28 #include "config.h" |
29 #include "core/html/parser/CSSPreloadScanner.h" | 29 #include "core/html/parser/CSSPreloadScanner.h" |
30 | 30 |
31 #include "FetchInitiatorTypeNames.h" | 31 #include "FetchInitiatorTypeNames.h" |
32 #include "core/html/parser/HTMLIdentifier.h" | |
33 #include "core/html/parser/HTMLParserIdioms.h" | 32 #include "core/html/parser/HTMLParserIdioms.h" |
34 #include "platform/text/SegmentedString.h" | 33 #include "platform/text/SegmentedString.h" |
35 | 34 |
36 namespace WebCore { | 35 namespace WebCore { |
37 | 36 |
38 CSSPreloadScanner::CSSPreloadScanner() | 37 CSSPreloadScanner::CSSPreloadScanner() |
39 : m_state(Initial) | 38 : m_state(Initial) |
40 , m_requests(0) | 39 , m_requests(0) |
41 { | 40 { |
42 } | 41 } |
(...skipping 16 matching lines...) Expand all Loading... | |
59 for (const Char* it = begin; it != end && m_state != DoneParsingImportRules; ++it) | 58 for (const Char* it = begin; it != end && m_state != DoneParsingImportRules; ++it) |
60 tokenize(*it, source); | 59 tokenize(*it, source); |
61 m_requests = 0; | 60 m_requests = 0; |
62 } | 61 } |
63 | 62 |
64 void CSSPreloadScanner::scan(const HTMLToken::DataVector& data, const SegmentedS tring& source, PreloadRequestStream& requests) | 63 void CSSPreloadScanner::scan(const HTMLToken::DataVector& data, const SegmentedS tring& source, PreloadRequestStream& requests) |
65 { | 64 { |
66 scanCommon(data.data(), data.data() + data.size(), source, requests); | 65 scanCommon(data.data(), data.data() + data.size(), source, requests); |
67 } | 66 } |
68 | 67 |
69 void CSSPreloadScanner::scan(const HTMLIdentifier& identifier, const SegmentedS tring& source, PreloadRequestStream& requests) | 68 void CSSPreloadScanner::scan(const String& identifier, const SegmentedString& s ource, PreloadRequestStream& requests) |
abarth-chromium
2013/12/10 01:22:52
identifier -> tagName?
| |
70 { | 69 { |
71 const StringImpl* data = identifier.asStringImpl(); | 70 if (identifier.is8Bit()) { |
72 if (data->is8Bit()) { | 71 const LChar* begin = identifier.characters8(); |
73 const LChar* begin = data->characters8(); | 72 scanCommon(begin, begin + identifier.length(), source, requests); |
74 scanCommon(begin, begin + data->length(), source, requests); | |
75 return; | 73 return; |
76 } | 74 } |
77 const UChar* begin = data->characters16(); | 75 const UChar* begin = identifier.characters16(); |
78 scanCommon(begin, begin + data->length(), source, requests); | 76 scanCommon(begin, begin + identifier.length(), source, requests); |
79 } | 77 } |
80 | 78 |
81 inline void CSSPreloadScanner::tokenize(UChar c, const SegmentedString& source) | 79 inline void CSSPreloadScanner::tokenize(UChar c, const SegmentedString& source) |
82 { | 80 { |
83 // We are just interested in @import rules, no need for real tokenization he re | 81 // We are just interested in @import rules, no need for real tokenization he re |
84 // Searching for other types of resources is probably low payoff. | 82 // Searching for other types of resources is probably low payoff. |
85 switch (m_state) { | 83 switch (m_state) { |
86 case Initial: | 84 case Initial: |
87 if (isHTMLSpace<UChar>(c)) | 85 if (isHTMLSpace<UChar>(c)) |
88 break; | 86 break; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 m_state = Initial; | 222 m_state = Initial; |
225 } else if (equalIgnoringCase(m_rule, "charset")) | 223 } else if (equalIgnoringCase(m_rule, "charset")) |
226 m_state = Initial; | 224 m_state = Initial; |
227 else | 225 else |
228 m_state = DoneParsingImportRules; | 226 m_state = DoneParsingImportRules; |
229 m_rule.clear(); | 227 m_rule.clear(); |
230 m_ruleValue.clear(); | 228 m_ruleValue.clear(); |
231 } | 229 } |
232 | 230 |
233 } | 231 } |
OLD | NEW |