| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePi
xelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLReplacem
ent); | 291 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePi
xelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLReplacem
ent); |
| 292 } else if (match(attributeName, sizesAttr) && !m_sourceSizeSet) { | 292 } else if (match(attributeName, sizesAttr) && !m_sourceSizeSet) { |
| 293 m_sourceSize = SizesAttributeParser(m_mediaValues, attributeValue).l
ength(); | 293 m_sourceSize = SizesAttributeParser(m_mediaValues, attributeValue).l
ength(); |
| 294 m_sourceSizeSet = true; | 294 m_sourceSizeSet = true; |
| 295 if (!m_srcsetImageCandidate.isEmpty()) { | 295 if (!m_srcsetImageCandidate.isEmpty()) { |
| 296 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), m_sourceSize, m_srcsetAttributeValue); | 296 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), m_sourceSize, m_srcsetAttributeValue); |
| 297 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLRepl
acement); | 297 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLRepl
acement); |
| 298 } | 298 } |
| 299 } else if (!m_referrerPolicySet && match(attributeName, referrerpolicyAt
tr) && !attributeValue.isNull()) { | 299 } else if (!m_referrerPolicySet && match(attributeName, referrerpolicyAt
tr) && !attributeValue.isNull()) { |
| 300 m_referrerPolicySet = true; | 300 m_referrerPolicySet = true; |
| 301 SecurityPolicy::referrerPolicyFromString(attributeValue, &m_referrer
Policy); | 301 SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords(attribute
Value, &m_referrerPolicy); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 template<typename NameType> | 305 template<typename NameType> |
| 306 void processLinkAttribute(const NameType& attributeName, const String& attri
buteValue) | 306 void processLinkAttribute(const NameType& attributeName, const String& attri
buteValue) |
| 307 { | 307 { |
| 308 // FIXME - Don't set rel/media/crossorigin multiple times. | 308 // FIXME - Don't set rel/media/crossorigin multiple times. |
| 309 if (match(attributeName, hrefAttr)) { | 309 if (match(attributeName, hrefAttr)) { |
| 310 setUrlToLoad(attributeValue, DisallowURLReplacement); | 310 setUrlToLoad(attributeValue, DisallowURLReplacement); |
| 311 } else if (match(attributeName, relAttr)) { | 311 } else if (match(attributeName, relAttr)) { |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 viewport->set = true; | 554 viewport->set = true; |
| 555 } | 555 } |
| 556 FloatSize initialViewport(mediaValues->deviceWidth(), mediaValues->deviceHei
ght()); | 556 FloatSize initialViewport(mediaValues->deviceWidth(), mediaValues->deviceHei
ght()); |
| 557 PageScaleConstraints constraints = description.resolve(initialViewport, docu
mentParameters->defaultViewportMinWidth); | 557 PageScaleConstraints constraints = description.resolve(initialViewport, docu
mentParameters->defaultViewportMinWidth); |
| 558 mediaValues->overrideViewportDimensions(constraints.layoutSize.width(), cons
traints.layoutSize.height()); | 558 mediaValues->overrideViewportDimensions(constraints.layoutSize.width(), cons
traints.layoutSize.height()); |
| 559 } | 559 } |
| 560 | 560 |
| 561 static void handleMetaReferrer(const String& attributeValue, CachedDocumentParam
eters* documentParameters, CSSPreloadScanner* cssScanner) | 561 static void handleMetaReferrer(const String& attributeValue, CachedDocumentParam
eters* documentParameters, CSSPreloadScanner* cssScanner) |
| 562 { | 562 { |
| 563 ReferrerPolicy metaReferrerPolicy = ReferrerPolicyDefault; | 563 ReferrerPolicy metaReferrerPolicy = ReferrerPolicyDefault; |
| 564 if (!attributeValue.isEmpty() && !attributeValue.isNull() && SecurityPolicy:
:referrerPolicyFromString(attributeValue, &metaReferrerPolicy)) { | 564 if (!attributeValue.isEmpty() && !attributeValue.isNull() && SecurityPolicy:
:referrerPolicyFromStringWithLegacyKeywords(attributeValue, &metaReferrerPolicy)
) { |
| 565 documentParameters->referrerPolicy = metaReferrerPolicy; | 565 documentParameters->referrerPolicy = metaReferrerPolicy; |
| 566 } | 566 } |
| 567 cssScanner->setReferrerPolicy(documentParameters->referrerPolicy); | 567 cssScanner->setReferrerPolicy(documentParameters->referrerPolicy); |
| 568 } | 568 } |
| 569 | 569 |
| 570 template <typename Token> | 570 template <typename Token> |
| 571 static void handleMetaNameAttribute(const Token& token, CachedDocumentParameters
* documentParameters, MediaValuesCached* mediaValues, CSSPreloadScanner* cssScan
ner, ViewportDescriptionWrapper* viewport) | 571 static void handleMetaNameAttribute(const Token& token, CachedDocumentParameters
* documentParameters, MediaValuesCached* mediaValues, CSSPreloadScanner* cssScan
ner, ViewportDescriptionWrapper* viewport) |
| 572 { | 572 { |
| 573 const typename Token::Attribute* nameAttribute = token.getAttributeItem(name
Attr); | 573 const typename Token::Attribute* nameAttribute = token.getAttributeItem(name
Attr); |
| 574 if (!nameAttribute) | 574 if (!nameAttribute) |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 ASSERT(document); | 810 ASSERT(document); |
| 811 doHtmlPreloadScanning = !document->settings() || document->settings()->doHtm
lPreloadScanning(); | 811 doHtmlPreloadScanning = !document->settings() || document->settings()->doHtm
lPreloadScanning(); |
| 812 doDocumentWritePreloadScanning = doHtmlPreloadScanning && document->frame()
&& document->frame()->isMainFrame(); | 812 doDocumentWritePreloadScanning = doHtmlPreloadScanning && document->frame()
&& document->frame()->isMainFrame(); |
| 813 defaultViewportMinWidth = document->viewportDefaultMinWidth(); | 813 defaultViewportMinWidth = document->viewportDefaultMinWidth(); |
| 814 viewportMetaZeroValuesQuirk = document->settings() && document->settings()->
viewportMetaZeroValuesQuirk(); | 814 viewportMetaZeroValuesQuirk = document->settings() && document->settings()->
viewportMetaZeroValuesQuirk(); |
| 815 viewportMetaEnabled = document->settings() && document->settings()->viewport
MetaEnabled(); | 815 viewportMetaEnabled = document->settings() && document->settings()->viewport
MetaEnabled(); |
| 816 referrerPolicy = document->getReferrerPolicy(); | 816 referrerPolicy = document->getReferrerPolicy(); |
| 817 } | 817 } |
| 818 | 818 |
| 819 } // namespace blink | 819 } // namespace blink |
| OLD | NEW |