| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 { | 164 { |
| 165 if (match(attributeName, charsetAttr)) | 165 if (match(attributeName, charsetAttr)) |
| 166 m_charset = attributeValue; | 166 m_charset = attributeValue; |
| 167 | 167 |
| 168 if (match(m_tagImpl, scriptTag)) { | 168 if (match(m_tagImpl, scriptTag)) { |
| 169 if (match(attributeName, srcAttr)) | 169 if (match(attributeName, srcAttr)) |
| 170 setUrlToLoad(attributeValue, DisallowURLReplacement); | 170 setUrlToLoad(attributeValue, DisallowURLReplacement); |
| 171 else if (match(attributeName, crossoriginAttr)) | 171 else if (match(attributeName, crossoriginAttr)) |
| 172 setCrossOriginAllowed(attributeValue); | 172 setCrossOriginAllowed(attributeValue); |
| 173 } else if (match(m_tagImpl, imgTag)) { | 173 } else if (match(m_tagImpl, imgTag)) { |
| 174 int effectiveSize = -1; // FIXME - hook up the real value from `size
s` |
| 174 if (match(attributeName, srcAttr) && !m_encounteredImgSrc) { | 175 if (match(attributeName, srcAttr) && !m_encounteredImgSrc) { |
| 175 m_encounteredImgSrc = true; | 176 m_encounteredImgSrc = true; |
| 176 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), attributeValue, m_srcsetImageCandidate), AllowURLReplacement); | 177 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), effectiveSize, attributeValue, m_srcsetImageCandidate), AllowURL
Replacement); |
| 177 } else if (match(attributeName, crossoriginAttr)) { | 178 } else if (match(attributeName, crossoriginAttr)) { |
| 178 setCrossOriginAllowed(attributeValue); | 179 setCrossOriginAllowed(attributeValue); |
| 179 } else if (RuntimeEnabledFeatures::srcsetEnabled() | 180 } else if (RuntimeEnabledFeatures::srcsetEnabled() |
| 180 && match(attributeName, srcsetAttr) | 181 && match(attributeName, srcsetAttr) |
| 181 && m_srcsetImageCandidate.isEmpty()) { | 182 && m_srcsetImageCandidate.isEmpty()) { |
| 182 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), attributeValue); | 183 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), effectiveSize, attributeValue); |
| 183 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), m_urlToLoad, m_srcsetImageCandidate), AllowURLReplacement); | 184 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), effectiveSize, m_urlToLoad, m_srcsetImageCandidate), AllowURLRep
lacement); |
| 184 } | 185 } |
| 185 } else if (match(m_tagImpl, linkTag)) { | 186 } else if (match(m_tagImpl, linkTag)) { |
| 186 if (match(attributeName, hrefAttr)) | 187 if (match(attributeName, hrefAttr)) |
| 187 setUrlToLoad(attributeValue, DisallowURLReplacement); | 188 setUrlToLoad(attributeValue, DisallowURLReplacement); |
| 188 else if (match(attributeName, relAttr)) | 189 else if (match(attributeName, relAttr)) |
| 189 m_linkIsStyleSheet = relAttributeIsStyleSheet(attributeValue); | 190 m_linkIsStyleSheet = relAttributeIsStyleSheet(attributeValue); |
| 190 else if (match(attributeName, mediaAttr)) | 191 else if (match(attributeName, mediaAttr)) |
| 191 m_matchedMediaAttribute = mediaAttributeMatches(*m_mediaValues,
attributeValue); | 192 m_matchedMediaAttribute = mediaAttributeMatches(*m_mediaValues,
attributeValue); |
| 192 else if (match(attributeName, crossoriginAttr)) | 193 else if (match(attributeName, crossoriginAttr)) |
| 193 setCrossOriginAllowed(attributeValue); | 194 setCrossOriginAllowed(attributeValue); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 if (m_token.type() == HTMLToken::StartTag) | 417 if (m_token.type() == HTMLToken::StartTag) |
| 417 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); | 418 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); |
| 418 m_scanner.scan(m_token, m_source, requests); | 419 m_scanner.scan(m_token, m_source, requests); |
| 419 m_token.clear(); | 420 m_token.clear(); |
| 420 } | 421 } |
| 421 | 422 |
| 422 preloader->takeAndPreload(requests); | 423 preloader->takeAndPreload(requests); |
| 423 } | 424 } |
| 424 | 425 |
| 425 } | 426 } |
| OLD | NEW |