OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 { | 61 { |
62 return threadSafeMatch(name, qName); | 62 return threadSafeMatch(name, qName); |
63 } | 63 } |
64 | 64 |
65 static const StringImpl* tagImplFor(const HTMLToken::DataVector& data) | 65 static const StringImpl* tagImplFor(const HTMLToken::DataVector& data) |
66 { | 66 { |
67 AtomicString tagName(data); | 67 AtomicString tagName(data); |
68 const StringImpl* result = tagName.impl(); | 68 const StringImpl* result = tagName.impl(); |
69 if (result->isStatic()) | 69 if (result->isStatic()) |
70 return result; | 70 return result; |
71 return 0; | 71 return nullptr; |
72 } | 72 } |
73 | 73 |
74 static const StringImpl* tagImplFor(const String& tagName) | 74 static const StringImpl* tagImplFor(const String& tagName) |
75 { | 75 { |
76 const StringImpl* result = tagName.impl(); | 76 const StringImpl* result = tagName.impl(); |
77 if (result->isStatic()) | 77 if (result->isStatic()) |
78 return result; | 78 return result; |
79 return 0; | 79 return nullptr; |
80 } | 80 } |
81 | 81 |
82 static String initiatorFor(const StringImpl* tagImpl) | 82 static String initiatorFor(const StringImpl* tagImpl) |
83 { | 83 { |
84 ASSERT(tagImpl); | 84 ASSERT(tagImpl); |
85 if (match(tagImpl, imgTag)) | 85 if (match(tagImpl, imgTag)) |
86 return imgTag.localName(); | 86 return imgTag.localName(); |
87 if (match(tagImpl, inputTag)) | 87 if (match(tagImpl, inputTag)) |
88 return inputTag.localName(); | 88 return inputTag.localName(); |
89 if (match(tagImpl, linkTag)) | 89 if (match(tagImpl, linkTag)) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 enum URLReplacement { | 130 enum URLReplacement { |
131 AllowURLReplacement, | 131 AllowURLReplacement, |
132 DisallowURLReplacement | 132 DisallowURLReplacement |
133 }; | 133 }; |
134 | 134 |
135 void processAttributes(const HTMLToken::AttributeList& attributes) | 135 void processAttributes(const HTMLToken::AttributeList& attributes) |
136 { | 136 { |
137 ASSERT(isMainThread()); | 137 ASSERT(isMainThread()); |
138 if (!m_tagImpl) | 138 if (!m_tagImpl) |
139 return; | 139 return; |
140 for (HTMLToken::AttributeList::const_iterator iter = attributes.begin();
iter != attributes.end(); ++iter) { | 140 for (const HTMLToken::Attribute& htmlTokenAttribute : attributes) { |
141 AtomicString attributeName(iter->name); | 141 AtomicString attributeName(htmlTokenAttribute.name); |
142 String attributeValue = StringImpl::create8BitIfPossible(iter->value
); | 142 String attributeValue = StringImpl::create8BitIfPossible(htmlTokenAt
tribute.value); |
143 processAttribute(attributeName, attributeValue); | 143 processAttribute(attributeName, attributeValue); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 void processAttributes(const Vector<CompactHTMLToken::Attribute>& attributes
) | 147 void processAttributes(const Vector<CompactHTMLToken::Attribute>& attributes
) |
148 { | 148 { |
149 if (!m_tagImpl) | 149 if (!m_tagImpl) |
150 return; | 150 return; |
151 for (Vector<CompactHTMLToken::Attribute>::const_iterator iter = attribut
es.begin(); iter != attributes.end(); ++iter) | 151 for (const CompactHTMLToken::Attribute& htmlTokenAttribute : attributes) |
152 processAttribute(iter->name, iter->value); | 152 processAttribute(htmlTokenAttribute.name, htmlTokenAttribute.value); |
153 } | 153 } |
154 | 154 |
155 void handlePictureSourceURL(String& sourceURL) | 155 void handlePictureSourceURL(String& sourceURL) |
156 { | 156 { |
157 if (match(m_tagImpl, sourceTag) && m_matchedMediaAttribute && sourceURL.
isEmpty()) | 157 if (match(m_tagImpl, sourceTag) && m_matchedMediaAttribute && sourceURL.
isEmpty()) |
158 sourceURL = m_srcsetImageCandidate.toString(); | 158 sourceURL = m_srcsetImageCandidate.toString(); |
159 else if (match(m_tagImpl, imgTag) && !sourceURL.isEmpty()) | 159 else if (match(m_tagImpl, imgTag) && !sourceURL.isEmpty()) |
160 setUrlToLoad(sourceURL, AllowURLReplacement); | 160 setUrlToLoad(sourceURL, AllowURLReplacement); |
161 } | 161 } |
162 | 162 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 if (m_token.type() == HTMLToken::StartTag) | 517 if (m_token.type() == HTMLToken::StartTag) |
518 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); | 518 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); |
519 m_scanner.scan(m_token, m_source, requests); | 519 m_scanner.scan(m_token, m_source, requests); |
520 m_token.clear(); | 520 m_token.clear(); |
521 } | 521 } |
522 | 522 |
523 preloader->takeAndPreload(requests); | 523 preloader->takeAndPreload(requests); |
524 } | 524 } |
525 | 525 |
526 } | 526 } |
OLD | NEW |